How to Install Docker and Docker compose on CentOS 8
Docker is a container management system. The Linux distribution and the necessary applications for the software being developed are deployed inside the container. Once configured, the container can be moved to any operating system where docker is installed, and work there without any additional steps. This is the reason for the popularity of Docker among developers and DevOps.
In the Serverspace you can create a server with already installed app "Docker".
In this tutorial, we will install Docker, Docker compose, and run a test container.
Docker installation on CentOS 8
To install and always update Docker to the latest version, add the developer repository to the system.
Install the Docker package.
Start the Docker service and add it to autorun.
CentOS 8 uses a firewall other than Docker. Hence, if you have firewalld enabled, you need to add a masquerade rule to it.
firewall-cmd --reload
Docker compose installation
Docker is often installed along with Docker compose. It is this utility that allows you to deploy your project to another machine using one command. To download it, run the following command:
Make it executable.
Using Docker as a non-root user
To be able to use Docker as a non-root user, you must add that user to the docker group.
Replace the username with the desired user name. After executing this command, he will need to log out from the system and log in again.
Be careful! Users of this group can take control of the Docker host.
Docker test container running
You can verify that Docker is working properly by running a test container.
As a result of executing the command, you should see a message that everything is working well.