Docker CE on Ubuntu To install Docker Engine - Community, you need the 64-bit version of one of these Ubuntu versions:
- Focal 20.04 (LTS)
- Disco 19.04
- Cosmic 18.10
- Bionic 18.04 (LTS)
- Xenial 16.04 (LTS)
That’s all you need. There aren’t many complex requirements.
Remove any older versions of Docker like so:
#Remove any older versions of docker
# use sudo if required
apt-get remove docker docker-engine docker.io containerd runc
There are many methods to install Docker CE. However, we will install it using the recommended approach: installing using repository.
Installation steps:
-
Update the apt package index
bash # Update package index # use sudo if required apt-get update
-
Install packages to allow apt to use a repository over HTTPS
# Use sudo if required
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 | apt-key add -
- Set up a stable repository
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
- Update the apt package index
apt-get update
- Install the latest version of Docker CE and containerd
apt-get install docker-ce docker-ce-cli containerd.io
That’s all you need. If everything goes well, you should be able to see the output of the command below. The command will provide all the information about Docker including a number of images and running containers etc.
sudo docker info
Tips: If you don’t want to use sudo for every Docker command, add your current user in the Docker group using:
sudo usermod -aG docker <your-user>