A quick few steps on how to install Docker on CentOS / RHEL.
All commands will be run as sudo.
First we will install needed packages.
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Next step will be to configure docker-ce repo
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io --nobest
I will now add myself to docker user group
sudo usermod -aG docker $(whoami)
We will now enable docker to start at CentOS startup
sudo systemctl enable docker.service
We will also start docker service right away
sudo systemctl start docker.service
Finally we will check version installed by typing in
sudo docker version
We will also install Docker Compose next
Docker Compose installation
At the moment of writing this you can find docker compose latest version here – https://github.com/docker/compose/releases/
We will download latest stable version by typing in following command
sudo curl -L https://github.com/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
Ok, we will now move docker compose from /usr/local/bin to /usr/bin folder by issuing following command
sudo mv /usr/local/bin/docker-compose /usr/bin/docker-compose
We will also modify permissions
sudo chmod +x /usr/bin/docker-compose
Finally, we will check the version by typing in
That is it, we are done.