How to Install Docker On Ubuntu 20.04 LTS Focal Fossa

Docker is a combination of platform as a service products that use virtualization to provide software in packages called containers which can communicate with each other through well-defined channels. This tutorial focuses on Installing the latest Docker release on Ubuntu 20.04 LTS Focal Fossa.

In this tutorial you will learn:

  • How to install Docker from the standard Ubuntu Repository
  • How to enable Docker to start after the system reboot
  • How to allow regular user to administrate Docker

Docker on Ubuntu 20.04 LTS Focal Fossa

Docker on Ubuntu 20.04 LTS Focal Fossa

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa
Software Docker
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to Install Docker On Ubuntu 20.04 LTS Focal Fossa step by step instructions

Install Docker From a standard Ubuntu Repository

  1. Use the apt command to install the docker.io package:
    sudo apt install docker.io
    


  2. Start docker and enable it to start after the system reboot:
    $ sudo systemctl enable --now docker
    
  3. Optionally give any user administrative privileges to docker:
    $ sudo usermod -aG docker SOMEUSERNAME
    

    You will need to log out and log in to apply the changes.

  4. Check docker version:
    $ docker --version
    


  5. Run docker test using the hello-world container:
    $ docker run hello-world
    
    Hello from Docker!
    This message shows that your installation appears to be working correctly.
    
    To generate this message, Docker took the following steps:
     1. The Docker client contacted the Docker daemon.
     2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
        (amd64)
     3. The Docker daemon created a new container from that image which runs the
        executable that produces the output you are currently reading.
     4. The Docker daemon streamed that output to the Docker client, which sent it
        to your terminal.
    
    To try something more ambitious, you can run an Ubuntu container with:
     $ docker run -it ubuntu bash
    
    Share images, automate workflows, and more with a free Docker ID:
     https://hub.docker.com/
    
    For more examples and ideas, visit:
     https://docs.docker.com/get-started/