Centos7 installation and deployment docker
Installation Environment
System: centos7 Memory: 4G
Network type: NAT mode Hard disk size: 80G
Mini-install language: English
IP:192.168.180.134
Basic environment configuration
- Set IP to obtain dynamically
vi /etc/sysconfig/network-scripts/ifcfg-ens33
Change BOOTPROTO="dhcp" to "static", and add IP, gateway, subnet mask, DNS information
Restart the network and check the network information. If no error is reported, the file configuration is successful.
At this time, the network can also be pinged normally.
Disable firewall and close selinux
systemctl disable firewalld
systemctl stop firewalld
setenforce 0 (Temporarily closed, it will still be automatically opened after the system restarts)
permanently closed
vi /etc/selinux/config
Change SELINUX=enforcing to SELINUX=disabled then save and exit
At this point, the basic environment for installing docker has been fully configured. If you are not proficient and afraid of making mistakes in the next steps, you can take snapshots here. If you make mistakes in the next steps, just restore the snapshots
start installation
1. Uninstall the docker version that comes with the system
yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
Update the yum package (this process needs to wait for a while)
yum update
Install the dependencies required by docker
yum install -y yum-utils device-mapper-persistent-data lvm2
Configure yum source
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
View all docker versions in the warehouse
yum list docker-ce --showduplicates | sort -r
Install the latest version of docker, if no version number is specified, it will be installed by default
yum install -y docker-ce
(If you want to specify the version number to install, you can enter the command: yum install docker-ce-18.09* -y, and the specified version is docker-ce-18.09 at this time)
Set docker to start automatically at boot
systemctl restart docker
systemctl enable docker
Verify that docker is installed successfully
docker -version
At this point, the docker installation has been completed, and some simple configurations need to be done below
Configure the daemon process of docker daemon
cd /etc/docker/
vim /etc/docker/daemon.json
Add the following configuration information:
{
“exec-opts”:[“native.cgroupdriver=systemd”]
}
then save and exit
Configure the docker server
vi /usr/lib/systemd/system/docker.service
Add the following information:
ExecStartPost=/usr/sbin/iptables -P FORWARD ACCEPT
then save and exit
Reload the daemon daemon
systemctl daemon-reload
View docker running status
systemctl status docker
At this point, the display is running