Docker is an open-source platform for developing, testing, and running applications. Docker allows to package and run an application in container. A container is an isolated environment which contains everything needed for application to run.
This tutorial explains how to install Docker Community Edition (CE) on Ubuntu 20.04.
To install the latest version of Docker on Ubuntu, run the command below. Sudo apt install docker-ce docker-ce-cli containerd.io. Docker should now be installed, the service started and enabled to start on boot. In addition, you can check the Docker state using.
Update the package lists using the following command:
Install package which allows to use a repository accessed via the HTTP:
Download GPG key and add to a specified directory:
Add the Docker CE repository:
Install the Docker CE:
By default, root and user with sudo privileges can use Docker. During installation
docker group is created. So if you want to allow to use Docker for non-root users, you can add user to the
Add current user to
To make changes to take effect, logout and login to your machine. After you’re reconnected, check Docker version:
We can use the following command to determine if Docker service is running:
We can also stop, start and restart the Docker service:
To test that Docker successfully installed, you can run the
The command downloads a test image, runs it in a container, prints message, and exits.
If you decided to completely remove Docker CE and related dependencies, run the following command:
When it finished, remove the
docker0 network interface is installed. You can remove it with command:
Remove GPG key and repository:
You can also remove Docker configuration, images, containers, and other related directories: