centos7 install docker-ce 18.01.0

1. Environment#

Due to company reasons, ubuntu cannot be used in production and can only use Centos, so the basis of this article is Centos.

Centos6.x definitely does not recommend installing docker for the following reasons:

  1. The operating requirements of docker can only be met by upgrading the kernel, but there is a risk that the kernel cannot be turned on when the kernel is upgraded.

  2. Even if the upgrade is successful, it is extremely unstable when running the container and will stop for no reason (the company's historical experience summed up, it may be caused by unfamiliar with docker, if someone solves it, you can reply to me, thank you very much);

  3. Devicemapper uses lvm, which has low performance.

The setting of this article is to use Centos 7.4 version, the kernel is 3.10.0.

Second, install##

2.1 ready##

  1. Check whether the centos-extras library is enabled. The default is enabled. If it has not been modified, skip this step.

  2. Check if the memory is enough, the minimum is 4G

  3. Install the dependent libraries. Note that the 18.01.0 version of docker does not require additional devicemapper configuration. You can use lvm2 by executing the following commands to avoid poor lvm performance.

yum install -y yum-utils \
 device-mapper-persistent-data \
 lvm2
  1. Set up the repository
yum-config-manager \
 - - add-repo \
 https://download.docker.com/linux/centos/docker-ce.repo

Note: If the stable library is recommended for production, if you want to use edge or test, execute the following command to enable

yum-config-manager --enable docker-ce-edge
yum-config-manager --enable docker-ce-test
  1. Turn off the firewall
systemctl stop firewalld.service #stop
systemctl disable firewalld.service #Disable

2.2 Start##

At the current time, the latest version of 2018-01-31 is 18.01.0, you can directly execute the following command to install

yum install docker-ce

If the latest version is greater than 18.01.0, you can install it as follows

  1. List all versions
yum list docker-ce --showduplicates | sort -r

Note that the first column is the name, the second column is the version, and the third column is the name of the resource library. Generally, stable is a stable library, edge is an edge library, and test is a test library. The stable library must be selected in the production environment, otherwise it will be unavailable. Problems foreseen.

  1. Install according to the list
yum install <FULLY-QUALIFIED-PACKAGE-NAME>

Note: The package name is a combination of intercepting partial values in the first column and the second column. For example, the list is as follows

docker-ce.x86_64            18.01.0.ce-1.el7.centos             docker-ce-stable

Then the package name should be docker-ce-18.01.0.ce

After the installation is complete, do not start it yet, because the default docker image is a foreign country, the download speed may be slower, click the following link: https://www.daocloud.io/mirror#accelerator-doc, if you need to log in, please register first. Then click again to get the accelerator code, and then copy it to the machine to run.

After the accelerator is set up, execute the following command to start docker

systemctl start docker

If the startup fails, enter the following command to view the reason for the startup failure

systemctl  status docker

Three, use#

3.1 Common commands##

  1. Check the docker version number
docker -v
  1. View docker information
docker info
  1. Start, stop, and restart the docker container
docker start <container name | id>
docker stop <container name | id>
docker rm <container name | id>
  1. View all running containers
docker ps -a
docker ps
  1. Enter the container by command line
docker exec -t -i <container name| id> bash
  1. Start, stop, and restart docker
systemctl start docker
systemctl stop docker
systemctl restart docker
  1. View the container log
docker logs -f <container name|id>
  1. Submit changes
docker commit -m "jre8"-a "scc"Container id image[:tag]
  1. View the mirror
docker images
  1. Clear the mirror
docker system prune -a

3.2 Detailed docker command##

Novice tutorial: http://www.runoob.com/docker/docker-command-manual.html

A good detailed explanation on CSDN: http://blog.csdn.net/permike/article/details/51879578

Recommended Posts

centos7 install docker-ce 18.01.0
1.5 Install Centos7
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13
CentOS install Redmine
CentOS7 install MySQL
Centos7 install protobuf
CentOS 7 install Docker
CentOS7 install GlusterFS
CentOS 7.4 install Zabbix 3.4
CentOS7 install Docker
Centos6.5 install Tomcat
Vmware install CentOS6
CentOS 7.2 install MariaDB
CentOS 7 install Hadoop 3.0.0
Centos7 install Python2.7
Centos 7.6 install seleniu
CentOS 7.3 install Zabbix3
Centos7 install LAMP+PHPmyadmin
CentOS install mysql
CentOS install openjdk 1.8
CENTOS6.5 install CDH5.12.1 (1)
CentOS install PHP
CentOS6 install mist.io
Centos7 install Docker
CentOS7 install mysql
centOs install rabbitMQ
CentOS 7 install MySQL 5.6
Centos7 install Nginx
CentOS6.5 install CDH5.13
Centos7 install docker18
Centos install Python3
centos7 install docker
CentOS install jdk
centos7 install nginx-rtmp
CentOS8 install MySQL8.0
Centos6.3 install KVM
CentOS install PostgreSQL 9.1
CentOS7 install mysql8
CentOS 7 install Java 1.8
CentOS8 install fastdfs6.06
CentOS 7 install Gitlab
Centos 7 install PostgreSQL
CentOS7 install MySQL8
CentOS 7 install Java 1.8
CentOS 6 install Docker
centos 6.5 install zabbix 4.4
Centos8 install Docker
CentOS6.8 install python2.7
CentOS install nodejs 8
CentOS6.5 install GNS3
centos 7.5 install mysql5.7.17
Centos7 install MySQL8.0-manual
CentOS7 install Kubernetes 1.16.3
VirtualBox install centos7
centos7 install lamp
Install centos7 and connect
Install Docker on Centos7
Centos7 install docker-18.x original
install LNMP on centos7.4
Centos7 YUM install MariaDB 10.0