Installing Docker, Docker Compose on Centos 8

There are slight differences when installing Docker and Docker Compose on Centos 8 compared to Centos 7

Installing Docker

Installing the required packages

$ sudo dnf -y install -y yum-utils device-mapper-persistent-data lvm2

Add the Docker CE repository

$ sudo dnf config-manager --add-repo=


$ dnf list docker-ce
Available Packages
docker-ce.x86_64                3:19.03.12-3.el7                docker-ce-stable

Install Docker-CE

$ sudo dnf -y install docker-ce --nobest

Add our user, under which we configure the OS, to the Docker group

$ sudo usermod -aG docker $(whoami)

Apply changes to groups

$ newgrp docker

Add the service to startup and start it

$ sudo systemctl enable --now docker


$ docker -v
Docker version 19.03.12, build 48a66213fe

Installing Docker Compose

Download docker-compose to the / usr / local / bin / directory

$ sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Making the file executable and creating a symlink

$ sudo chmod +x /usr/local/bin/docker-compose
$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose


$ docker-compose -v
docker-compose version 1.26.2, build eefe0d31

Setting up a firewall

To run docker compose with external access to the web server on Centos 8, you need to enable NAT

$ sudo firewall-cmd --zone=public --add-masquerade --permanent
$ sudo firewall-cmd --reload