1. Install packages to allow apt to use a repository over HTTPS:
$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
  1. Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

3. Update the list of available packages in your linux system

apt-get update

  1. Install Docker by installing the docker-io package:

sudo apt-get install docker-ce

  1. Verify that Docker CE or Docker EE is installed correctly by running the hello-world image.
$ sudo docker run hello-world