关于linux:centos7下docker安装记录

35次阅读

共计 973 个字符,预计需要花费 3 分钟才能阅读完成。

装置工具包

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

设置后造成谬误

 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

报错

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

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

#重启服务器解决 

正文完
 0