centos7下docker安装记录

安装工具包

sudo yum install -y yum-utils

更换国内源

sudo yum-config-manager  --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
​
sudo sed -i 's/download.docker.com/mirrors.aliyun.com/docker-ce/g' /etc/yum.repos.d/docker-ce.repo

安装Docker

sudo yum install docker-ce docker-ce-cli containerd.io

防火墙设置

firewall-cmd --permanent --zone=trusted --add-interface=docker0

firewall-cmd --reload

image

设置后造成错误

 failed to start daemon: Error initializing network controller: Error creating default "bridge" network: Failed to program NAT chain: ZONE_CONFLICT: 'docker0' already bound to a zone
firewall-cmd --zone=trusted --remove-interface=docker0 
#解决方法,从信任区删除docker0 
firewall-cmd --get-zone-of-interface=docker0
firewall-cmd --reload

启动

sudo systemctl enable docker
sudo systemctl start docker
​
#查看报错命令 dockerd

建立 docker 用户组

sudo useradd docker
sudo groupadd docker
sudo usermod -G docker docker

测试

docker run hello-world

报错

image

解决(应该是docker权限问题)

systemctl daemon-reload
sudo service docker restart
sudo service docker status (should see active (running))
sudo docker run hello-world`

#重启服务器解决

centos7下docker安装记录_第1张图片

你可能感兴趣的:(linux,docker)