For those who want to build and run Docker-containers in CentOS-7 – first of all, it is necessary to install the Docker itself.
To install the latest version of Docker and be able to update it in the future without any problems – it is recommended to install Docker from the official repository.
Tip: Install Docker on Ubuntu 16.04 Xenial Xerus Read More →
In this tutorial, I’ll show you how to install a free Docker CE (Community Edition) in CentOS-7 from a stable official repository, how to make sure that it is installed correctly and that you usually need to do after installation.
Requirements: To install the Docker in CentOS 7 – you must have a 64-bit architecture and a Linux kernel version 3.10 or higher. Having executed arch
and uname -r
, it is possible to check up whether the system corresponds to the given requirements.
Installing the Docker in CentOS-7
Configure a stable Docker repository:
1 |
$ sudo yum-config-manager -add-repo https://download.docker.com/linux/centos/docker-ce.repo |
Install the Docker:
1 |
$ sudo yum install docker-ce |
Run the Docker:
1 |
$ sudo systemctl start docker |
Make sure that the Docker is installed correctly by running the image hello-world
:
1 |
$ sudo docker run hello-world |
Tip: Docker has been successfully installed! It’s time to launch the first Docker-container! Read More →
Post-Installation Steps
After installing the Docker, you need to do a few more things.
First of all, you need to configure the automatic launch of the Docker daemon when the system boots.
Run the following command to add the Docker to startup:
1 |
$ sudo systemctl enable docker |
And secondly, so that each time you docker
do not type a command sudo
, add your user to the group docker
:
1 |
$ sudo usermod -aG docker $ USER |
Information: To end the user’s binding to the group, log out and log back in.
To make sure that you can run docker
without sudo
, run:
1 |
$ docker run hello-world |