Getting Started with Docker
Docker is an open platform for app development, delivery, and maintenance. Docker allows you to decouple your apps from your infrastructure, allowing you to release software more quickly. Docker allows you to manage your infrastructure in the same manner that you control your apps. You may drastically minimize the time between developing code and executing it in production by utilizing Docker's methodology for fast shipping, testing, and deploying code.
Docker vs. Virtual Machines
- OS Support and Architecture
Virtual machines have guest operating systems inside individual VMs but Docker is hosted on the physical machines' OS which makes it much lighter. Docker gives the flexibility to run multiple architectures over a single kernel.
2. Security
VM are stand-alone with their own kernel and security features, Applications that require more privileges and security are recommended to run on a virtual machine. Because Docker is running on a single host kernel and if one single application is compromised then it could bring a way to hack the entire host machine.
3. Portability
Docker containers are always packed with all the requirements and any hardware which has a container engine should be able to run the container. Whereas in the case of the virtual machine, it has been compatible with the host machine and operating system.
4. Performance
Virtual Machine is always more resource-consuming whereas Docker is considered to be light and easy to build and ship with any CI/CD process.
How to Install Docker in Linux
This could be the best resource to check for official installation documentation. https://docs.docker.com/engine/install/
Simple Method:
Manual Method:
# Remove any existing docker
sudo apt-get remove docker docker-engine docker.io containerd runc
# Update package libraries
sudo apt-get update
# Install basic requirements
1sudo apt-get -y install ca-certificates curl gnupg lsb-release
# Add gpg key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Add apt repository
sudo bash -c 'echo "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker-ce.list'
# Update to pull the docker packages
sudo apt-get update
# Install docker engine
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# If you want docker-compose
sudo apt-get install docker-compose
Executing the Docker Command Without Sudo
Adding a docker group to the logged-in user will give the privilege to run docker commands without sudo.
sudo usermod -aG docker ${USER}
Verify Docker installation
# Check docker verion
docker version
# Run Hello-world
docker run hello-world
That's it for now, will catch up in another blog post, Stay tuned!