Docker is an application that simplifies the process of managing application processes in containers. Containers let you run your applications in resource-isolated processes. They’re similar to virtual machines, but containers are more portable, more resource-friendly, and more dependent on the host operating system.

In this tutorial, you’ll install and use Docker Community Edition (CE) on Ubuntu 20.04 Focal Fossa. 

 

1. Update software repository

$ sudo apt update

 

2. Install prerequisite packages Add the GPG key for the official Docker repository to your system:

$ sudo apt install apt-transport-https ca-certificates curl software-properties-common

 

3. Add the GPG key for the official Docker repository to your system:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

 

4. Add the Docker repository to APT sources:

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

 

5. Update the package database with the Docker packages from the newly added repo:

$ sudo apt update

 

6. Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:

$ apt-cache policy docker-ce

 

7. Finally, install Docker:

$ sudo apt install docker-ce

 

8. Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:

$ sudo systemctl status docker

 

9. Executing the Docker Command Without Sudo (Optional)

$ sudo usermod -aG docker {USER}

 

You need to log out and log in again

10. Install Portainer, run your first container

Portainer is a lightweight management UI which allows you to easily manage your different Docker environments (Docker hosts or Swarm clusters).

$ docker volume create portainer_data | docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce

 

Now open browser and navigate to http://localhost:9000