CentOS Docker installation
Docker supports the following CentOS versions:
- CentOS 7 (64-bit)
- CentOS 6.5 (64-bit) or higher
Prerequisites
Currently, Docker is supported by the kernel in CentOS only releases.
Docker runs on CentOS 7 and requires a 64-bit system and a system kernel version of more than 3.10.
Docker runs on CentOS-6.5 or higher and requires a 64-bit system, 2.6.32-431, or later.
Install with yum (under CentOS 7)
Docker requires the kernel version of the CentOS system to be higher than 3.10, and check the prerequisites on this page to verify that your CenterOS version supports Docker.
View your current kernel version with the uname -r command[root@w3cschool ~]# uname -r 3.10.0-327.el7.x86_64
Install Docker
Docker packages and dependency packages are already included in the default CentOS-Extras software source, and the installation commands are as follows:
[root@w3cschool ~]# yum -y install docker
The installation is complete.
Start the Docker background service
[root@w3cschool ~]# service docker start
Test run hello-world
[root@w3cschool ~]#docker run hello-world
Since there is no hello-world image locally, a hello-world image is downloaded and run within the container.
Use a script to install Docker
1. Sign in
sudo
with
root
or root permissions.
2, make sure that the yum package is updated to the latest.
$ sudo yum update
3, execute docker installation script.
$ curl -fsSL https://get.docker.com/ | sh
Executing this script adds
docker.repo
source and installs Docker.
4, start the Docker process.
$ sudo service docker start
5. Verify that
docker
was successfully installed and that a test image was performed in the container.
$ sudo docker run hello-world
At this end, docker's installation on the CentOS system is complete.