Installing Docker CE on Ubuntu

Docker CE – a software platform for deploying applications, packaging applications into a container, adding libraries and all the necessary dependencies to run the application, which allows you to quickly launch the code in almost any environment. There is a free version of Docker Community Edition (CE) and Enterprise Edition (EE).

For an example I’ll install the Docker CE in Ubuntu 20.04 LTS.

Remove the old versions of Docker, if they are installed:

sudo apt-get remove docker docker-engine docker.io containerd runc

Add the official Docker GPG key and specify the stable repository:

sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
 
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker:

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

If you need to install a specific version, you can specify:

apt-cache madison docker-ce
sudo apt-get install docker-ce=18.03.0.ce docker-ce-cli=18.03.0.ce containerd.io

But when the system is updated, the update to the latest will be performed.

Verify that Docker is successfully installed:

sudo docker run hello-world

To uninstall Docker CE with all data, you must:

sudo apt-get purge docker-ce docker-ce-cli containerd.io
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

Leave a comment

Leave a Reply