Install Docker on CentOS-7

For ones, who want to build and run Docker containers on CentOS-7 – first of all it is required to install Docker itself.

To install the latest version of Docker and to be able to upgrade it easily in future – it is recommended to install Docker from the official repository.

In this guide i will show how to install free Docker CE (Community Edition) on CentOS-7 from the stable official repository, how to verify that it is installed correctly and will show the common post-installation steps to perform.

Requirements: To install Docker on CentOS-7 – you must have 64-bit architecture and Linux kernel version 3.10 or higher. You can check if your system matches the requirements with the arch and uname -r commands.

Install Docker on CentOS-7

Set up the stable Docker’s repository:

$ sudo yum-config-manager --add-repo

Install Docker:

$ sudo yum install docker-ce

Start Docker:

$ sudo systemctl start docker

Verify that Docker is installed correctly by running the hello-world image:

$ sudo docker run hello-world

Cool Tip: Docker successfully installed! It’s time to run first container! Read More →

Post-Installation Steps

Once Docker is installed, there are few more things left to do.

First of all it is required to configure Docker daemon to start automatically at system boot.

Run the following command to add Docker to autostart:

$ sudo systemctl enable docker

And secondly, add your user to the docker group to get rid of the need of typing sudo each time you run the docker command:

$ sudo usermod -aG docker $USER

Info: Log out and log back to complete the group assignment.

To verify that you can run docker without sudo, execute:

$ docker run hello-world
Was it useful? Share this post with the world!

Leave a Reply