Docker supports the following CentOS versions
- CentOS 7 (64-bit)
- CentOS 6.5 (64-bit) or higher
Preconditions
Currently, CentOS only supports Docker in the kernel in the release version.
Docker runs on CentOS 7 and requires a 64-bit system and a system kernel version of 3.10 or above.
Docker runs on CentOS-6.5 or higher version of CentOS, requires a 64-bit system and a system kernel version of 2.6.32-431 or higher
1. Check the current system kernel version
[root@docker ~]# uname -r 3.10.0-514.el7.x86_64
Install Docker
The Docker package and dependencies are already included in the default CentOS-Extras repositories. The installation command is as follows:
[root@runoob ~]# yum -y install docker-io
Installation is complete.?/p>
Start the Docker background service
[root@runoob ~]# service docker start
Test run hello-world
[root@runoob ~]#docker run hello-world
Since there is no hello-world image locally, a hello-world image will be downloaded and run in the container
Install Docker using a script
1. Make sudo或
root
permission to log in to Centos
2. Make sure the yum package is updated to the latest
$ sudo yum update
3. Execute the Docker installation script
$ curl -fsSL https://get.docker.com/ | sh
Executing this script will add the docker.repo
sources and install Docker
4. Start the Docker process
$ sudo service docker start
5. Verify docker
that the installation was successful and execute a test image in the container
$ sudo docker run hello-world
At this point, the installation of docker on the CentOS system is complete
Mirror acceleration
In view of domestic network problems, the subsequent pull of Docker images is very slow, we may need to configure accelerators to solve the problem, I use NetEase's image address
http://hub-mirror.c.163.com
The new version of Docker uses /etc/docker/daemon.json (Linux) or %programdata%\docker\config\daemon.json (Windows) to configure Daemon
Please add it to the configuration file (if there is no such file, please create one first)
{ "registry-mirrors": ["http://hub-mirror.c.163.com"] }
uninstall
1. Query installed packages
yum list installed | grep docker docker-engine.x86_64 17.03.0.ce-1.el7.centos @dockerrepo
2. Remove installed packages
yum -y remove docker-engine.x86_64
3. Delete the image/container
rm -rf /var/lib/docker
Reference address: