docker problem set

Keywords: Programming Docker SELinux yum CentOS

The following problems were encountered while installing 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

Prompt for container SELinux

terms of settlement:

Encounter the situation of contain SELinux

So we just need to make it up!

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 ා install the latest container SELinux

Then you can download it

-------------------------------------------------Dividing line----------------------------------------------------

After the docker is installed, testing the hello-world image prompts the following problems

[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'.

Because this is an intranet server, we do two actions (ps: the second step is only needed for the intranet server)

1. Switch the docker source to domestic Alibaba cloud's

2. Set the docker agent

1. New documents

vim  etc/docker/daemon.json



{

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

}

Then restart docker

systemctl restart docker

 

2. Set the docker agent

 

Create directory

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

 

create a file

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

 

Configure http-proxy.conf Add the following content to the document

[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"

 

Note: be sure to add the private library address to no_ In proxy, otherwise, you cannot push the image to the private library.

daemon reload s and restarts docker

systemctl daemon-reload

systemctl restart docker



Check if the variable is loaded

systemctl show docker --property Environment

Posted by wchris on Fri, 22 May 2020 08:03:14 -0700