In this blog, will demonstrate how to install Docker on Ubuntu. Below is the small post from the official documentation provided by docker and from my experience. To read more on the same refer the official website at Docker Docs
The current Docker Engine package is now called docker-ce. Older versions of Docker were called docker, docker.io, or docker-engine.
If you really want to use docker for some complex build images I will recommend the below steps to be performed. If you want to try docker for some fun or basics then you can use the
"Install using the convenience script" easy setup mentioned in the document here Docker Docs convenience-script
To get started with Docker Engine on Ubuntu,
Step 1: Uninstall previous versions
Recommend to Uninstall old versions:
sudo apt-get remove docker docker-engine docker.io containerd runc
apt-get might report none of these packages are installed but its completely fine.
Docker in installed at the location /var/lib/docker/
The contents of /var/lib/docker/, including builder containers, network, plugins, swarm, trust, buildkit, image, overlay2, runtimes, tmp, volumes.
Step 2: Set-up Repository
-Update the apt package index
sudo apt-get update
-Install packages to allow apt to use a repository over HTTPS
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
-Add Docker’s official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Verify key with the fingerprint added, 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
sudo apt-key fingerprint 0EBFCD88
Setup the repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Prepare install from docker Repository
apt-cache policy docker-ce
Step 3: Install Docker
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
Docker should now be installed.
Step 4: Verify Installation
sudo docker version
Client: Docker Engine - Community
Version: 19.03.12
Verify if the docker daemon started, and the process enabled to start on boot. Check that it’s running:
sudo systemctl status docker
docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2020-09-18 16:01:13 IST; 39min ago
Step 5: Add user to docker
The Docker command can only be run the root user. If you want to run with other user which is recommended add the user to docker group.
sudo usermod -aG docker ${USER}
Step 5: Run an docker image
sudo docker run hello-world
1 Comments
Great stuff. I was having issues deploying docker with other tutorial pages. Tours worked perfectly !
ReplyDeleteThanks a lot