docker问题集合

编程

[root@sm-docker249 yum.repos.d]# yum install docker-ce docker-ce-cli containerd.io

Loaded plugins: fastestmirror, langpacks

docker-ce-nightly | 3.5 kB 00:00

docker-ce-stable | 3.5 kB 00:00

docker-ce-test | 3.5 kB 00:00

(1/4): docker-ce-test/x86_64/primary_db | 115 kB 00:00

(2/4): docker-ce-nightly/x86_64/updateinfo | 55 B 00:00

(3/4): docker-ce-test/x86_64/updateinfo | 55 B 00:00

(4/4): docker-ce-nightly/x86_64/primary_db | 166 kB 00:00

Loading mirror speeds from cached hostfile

Resolving Dependencies

--> Running transaction check

---> Package containerd.io.x86_64 0:1.2.13-3.2.el7 will be installed

--> Processing Dependency: container-selinux >= 2:2.74 for package: containerd.io-1.2.13-3.2.el7.x86_64

---> Package docker-ce.x86_64 3:19.03.9-3.el7 will be installed

--> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-19.03.9-3.el7.x86_64

---> Package docker-ce-cli.x86_64 1:19.03.9-3.el7 will be installed

--> Finished Dependency Resolution

Error: Package: 3:docker-ce-19.03.9-3.el7.x86_64 (docker-ce-stable)

Requires: container-selinux >= 2:2.74

Error: Package: containerd.io-1.2.13-3.2.el7.x86_64 (docker-ce-nightly)

Requires: container-selinux >= 2:2.74

You could try using --skip-broken to work around the problem

You could try running: rpm -Va --nofiles –nodigest

提示需要container-selinux

解决办法:

遇到了contain-SElinux的情况

所以我们只需要把他补上就行了!

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 

yum install epel-release -y

yum install container-selinux -y    #安装最新的contain-selinux

然后就可以下载成功了

-------------------------------------------------分割线----------------------------------------------------

docker安装好之后测试hello-world镜像提示以下问题

[root@sm-docker249 yum.repos.d]# docker run hello-world

Unable to find image "hello-world:latest" locally

docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp 18.232.227.119:443: connect: connection refused.

See "docker run --help".

这里因为是内网服务器,所以我们做两个动作(ps:第二步只有内网服务器才需要)

1.切换docker源为国内阿里云的

2.设置docker代理

1.新增文件

vim  etc/docker/daemon.json

{

"registry-mirrors": ["https://alzgoonw.mirror.aliyuncs.com"]

}

然后重启docker

systemctl restart docker

 

2.设置docker代理

 

创建目录

mkdir /etc/systemd/system/docker.service.d

 

创建文件

vim /etc/systemd/system/docker.service.d/http-proxy.conf

 

配置http-proxy.conf文件增加以下内容

[Service]

Environment="HTTP_PROXY=http://proxy.ip.com:80"

Environment="NO_PROXY=localhost,127.0.0.0/8,docker-registry.somecorporation.com,11.11.225.50"

 

注意:一定要将私库地址添加到no_proxy里,否则,无法向私库里面push镜像。

daemon重新reload 并重启docker

systemctl daemon-reload

systemctl restart docker

检查变量是否加载

systemctl show docker --property Environment

 

以上是 docker问题集合 的全部内容, 来源链接: utcz.com/z/516674.html

回到顶部