The Docker on the server is a bit old with version 1.13, so I plan to upgrade it;
It turned out that after adding the Docker source, the installation using yum reported an error…, here is a summary;
Use yum to install docker error solution in centos7
Install Docker
First uninstall the old version:
sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
Then follow the software sources:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Check out the available versions:
yum list docker-ce --showduplicates | sort -r
So far the steps are normal;
When installing with the yum command:
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Error:
This system is not registered with an entitlement server. You can use subscription-manager to register. https://yum.dockerproject.org/repo/main/centos/7/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not FoundTrying other mirror....failure: repodata/repomd.xml from dockerrepo: [Errno 256] No more mirrors to try. https://yum.dockerproject.org/repo/main/centos/7/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
The reason is that link resolution in CentOS 7 has been deprecated;
You can try to replace: $releasever => 7
in /etc/yum.repos.d/docker-ce.repo
file Solved:
/etc/yum.repos.d/docker-ce.repo
[docker-ce-stable]name=Docker CE Stable - $basearch- baseurl=https://download.docker.com/linux/centos/$releasever/$basearch/stable+ baseurl=https://download.docker.com/linux/centos/7/$basearch/stableenabled=1gpgcheck=1gpgkey=https://download.docker.com/linux/centos/gpg
Install after replacement!
Set to start at boot:
systemctl enable docker
start up:
systemctl start docker
Check the startup status:
systemctl status docker
View version:
docker version
Compatible with older versions of Docker
Some of the installed docker versions are too old. After upgrading the docker version, this error is encountered when starting the container created by the old version:
docker start 容器IDError response from daemon: Unknown runtime specified docker-runc
This happens when docker is upgraded from an incompatible version and the docker container cannot be started after the upgrade, because the two versions of the old and new version commands are in different directories;
Solution:
- Change the file parameters in the
/var/lib/docker/containers
directory and replacedocker-runc
withrunc
It can be fixed with the following command:
grep -rl 'docker-runc' /var/lib/docker/containers/ | xargs sed -i 's/docker-runc/runc/g'
Note:
grep -rl
: recursively searches directories and subdirectories, listing only file names with matching text lines, without displaying specific matching content;xargs
: the value obtained before the connection is executed;The overall meaning is to search for
docker-runc
files in/var/lib/docker/containers
;And replace the
docker-runc
character withrunc
;
Restart Docker after the replacement is complete:
systemctl restart docker
appendix
Article reference:
- https://stackoverflow.com/questions/60970697/docker-install-failing-in-linux-with-error-errno-14-https-error-404-not-foun
- https://www.dockerchina.cn/?id=126
- https://blog.51cto.com/dongweizhen/3606988
This article is reprinted from: https://jasonkayzk.github.io/2022/08/14/centos7%E4%B8%AD%E4%BD%BF%E7%94%A8yum%E5%AE%89%E8%A3%85docker %E6%8A%A5%E9%94%99%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95/
This site is for inclusion only, and the copyright belongs to the original author.