How to quickly install docker on Linux (Centos version)

CentOS Docker installation

Docker supports the following CentOS versions:

Prerequisites

Currently, only the kernel in the release version of CentOS supports Docker.
Docker runs on CentOS 7 and requires a 64-bit system and system kernel version 3.10 or higher.
Docker runs on CentOS-6.5 or higher, and requires a 64-bit system and a system kernel version of 2.6.32-431 or higher.

Use yum to install (under CentOS 7)

Docker requires the kernel version of the CentOS system to be higher than 3.10. Check the prerequisites on this page to verify whether your CentOS version supports Docker.

View your current kernel version through the uname -r command

1[ root@VM_0_9_centos ~]# uname -r
23.10.0- 514.26.2. el7.x86_64

Install Docker

Starting in March 2017, docker has been divided into two branch versions on the original basis: Docker CE and Docker EE.
Docker CE is the community free version, and Docker EE is the enterprise version. It emphasizes security, but it needs to be paid for.
This article introduces the installation and use of Docker CE.

Remove the old version:

1 $ sudo yum remove docker \
 2     docker-client \
 3     docker-client-latest \
 4     docker-common \
 5     docker-latest \
 6     docker-latest-logrotate \
 7     docker-logrotate \
 8     docker-selinux \
 9     docker-engine-selinux \
10     docker-engine

Install some necessary system tools:

1 sudo yum install -y yum-utils device-mapper-persistent-data lvm2

Add software source information:

1 sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

Update yum cache:

1 sudo yum makecache fast

Install Docker-ce:

1 sudo yum -y install docker-ce

Start Docker background service

1 sudo systemctl start docker

Test run hello-world

1[ root@coderxm ~]# docker run hello-world

Since there is no hello-world image locally, a hello-world image will be downloaded and run in the container.

Use script to install Docker

  1. Log in to Centos with sudo or root privileges.
  2. Ensure that the yum package is updated to the latest.
1 sudo yum update
  1. Execute the Docker installation script.
1 curl -fsSL https://get.docker.com -o get-docker.sh
2 sudo sh get-docker.sh

Executing this script will add the docker.repo source and install Docker.

  1. Start the Docker process.
1 sudo systemctl start docker
  1. Verify that docker is installed successfully and execute a test image in the container.
1 sudo docker run hello-world

It can be seen that the console has output "Hello from Docker!" and other words. At this point, the installation of Docker in the CentOS system is complete.

Mirror acceleration

In view of the domestic network problems, the subsequent pull of the Docker image is very slow. We may need to configure the accelerator to solve it. I used the NetEase mirror 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):

1{2" registry-mirrors":["http://hub-mirror.c.163.com"]3}

Delete Docker CE

Execute the following command to delete Docker CE:

1 sudo yum remove docker-ce
2 sudo rm -rf /var/lib/docker

Recommended Posts

How to quickly install docker on Linux (Centos version)
How to install and use Docker on CentOS 7
How to install RPM packages on CentOS Linux
How to install Docker CE on RHEL 8 / CentOS 8
How to install jdk1.8 on centOS7
How to install MySQL on CentOS 8
How to install Memcached on CentOS 8
How to install R on CentOS 8
How to install FFmpeg on CentOS 8
How to install Virtualbox on CentOS 8
How to install TensorFlow on CentOS 8
How to install TeamViewer on CentOS 8
How to install Perl 5 on CentOS
How to install Git on CentOS 8
How to install Gradle on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Jenkins on CentOS 8
How to install Java on CentOS 8
How to install Go on CentOS 8
How to install GCC on CentOS 8
How to install Yarn on CentOS 8
How to install Asterisk on CentOS 7
How to install Jenkins on CentOS 8
How to install Python 3.8 on CentOS 8
How to install Tomcat 9 on CentOS 8
How to install Webmin on CentOS 8
How to install Ruby on CentOS 8
How to install Skype on CentOS 8
How to install htop on CentOS 8
How to install Python on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Postgresql on CentOS 8
How to install Wordpress on Centos
How to install htop on CentOS 8
How to install TeamViewer on CentOS 8
How to install MariaDB on CentOS 8
How to install MongoDB on CentOS 7
How to install Odoo 13 on CentOS 8
How to install Apache on CentOS 8
How to install OpenCV on CentOS 8
How to install PHP on CentOS 8
How to install MongoDB on CentOS 8
How to install Apache Maven on CentOS 8
How to install Apache Kafka on CentOS 7
R&D: How To Install Python 3 on CentOS 7
How to install GCC compiler on CentOS 7
How to install offline JDK1.8 on centos7.0
Install Docker on Centos7
install Docker on centos6.5
How to install Prometheus with Docker on Ubuntu 14.04
How to install Visual Studio Code on CentOS 8
How to install and use Docker on Ubuntu 20.04
How to install and configure VNC on CentOS 8
How to quickly deploy docker on ubuntu server
How to install and use Composer on CentOS 8
How to install and configure Redis on CentOS 8
How to install Node.js and npm on CentOS 8
How to install jdk1.8.0_151 and mysql5.6.38 on centos7.2.1511
How to install and configure phpMyAdmin on CentOS 6
How to install and use Curl on CentOS 8
How to install and configure Owncloud on CentOS 8