Docker - Install Docker on Linux

by
Jeremy Canfield |
Updated: July 26 2021
| Docker articles
The dnf install or yum install command can be used to install Docker on Linux Red Hat distribution (CentOS, Fedora, Red Hat).
dnf install docker
The which command can be used to determine the absolute path to the docker command line tool.
which docker
Something like this should be returned.
/usr/bin/docker
The systemctl or service command can be used to start and enable docker.
systemctl enable docker
systemctl start docker
The docker run command can be used to pul the hello-world image from Docker hub.
docker run hello-world
Something like this should be returned.
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c
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.
(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/
The docker images command should show that there is now a hello-world image.
~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest d1165f221234 3 months ago 13.3kB
Did you find this article helpful?
If so, consider buying me a coffee over at