Docker is one of the most important development tools over the last 10 years. In this article, we will summarize how to install docker on ubuntu.

Installing Docker

To install docker, simply type in the following commands

sudo apt update
sudo apt install -y

Grant Access

By default, docker needs root access to run. If you are the root, you don’t need this section. Otherwise, you can use sudo in front of each docker command to make it work. To avoid typeing sudo every time you run docker command, take the following steps.

  1. Create a docker group
sudo groupadd docker
  1. Add your user to the docker group
sudo usermod -aG docker $USER
  1. Restart docker
systemctl restart docker

Check If Docker Is Installed Correctly

To check if your docker is successfully installed, just do

docker run hello-world

If you see something like the following, it means your docker is functioning

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:97a379f4f88575512824f3b352bc03cd75e239179eea0fecc38e597b2209f49a
Status: Downloaded newer image for hello-world:latest

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.
 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:

For more examples and ideas, visit: