VK Cloud logo
Updated at April 15, 2024   08:50 AM

Installing Docker CE on Ubuntu

Docker CE (Community Edition) is a platform that allows working with containerized applications. Such applications are shipped in the containers, which contain all the necessary resources for the applications to operate. This allows to quickly build, deploy, and debug applications.

Containers are similar to virtual machines, but more lightweight. To isolate containerized application's resources, containers rely on the operation system on which they are running.

Preparatory steps

Make sure that:

  • You have an access to the terminal of the Ubuntu host, on which you are planning to install Docker CE.
  • You can use sudo on that host to run the commands on behalf of superuser (root).

1. Install Docker CE

  1. Connect to the terminal.

    All further actions listed below are to be performed in this terminal.

  2. Install the packages that are required for the further installation process:

    sudo apt update && \sudo apt install -y \  apt-transport-https \  ca-certificates \  curl \  software-properties-common
  3. Add the Docker repository's GPG key to the keyring:

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  4. Make sure that the GPG key was successfully added:

    apt-key list

    The command's output should contain the information about Docker repository's GPG key.

  5. Add the Docker repository:

    sudo add-apt-repository -u "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  6. Make sure that the repository was successfully added:

    apt-cache policy docker-ce

    The command's output should contain the information about the installation candidates for the docker-ce package.

  7. Install Docker CE:

    sudo apt install docker-ce -y

2. Check the correctness of the installation

  1. Connect to the terminal.

    All further actions listed below are to be performed in this terminal.

  2. Make sure that Docker CE is installed and running:

    sudo systemctl status docker --no-pager -l

    The command's output should contain the information that the service is in active (running) state.

  3. Get general information about the installed Docker CE:

    sudo docker info
  4. Run the hello-world test container:

    sudo docker run --rm hello-world

    The container will display a greeting message and terminate.