記CentOS8下安裝Docker


今天換了台CentOS8機器,按以前裝的時候發現有些地方不同,在此記錄下

[root@VM-0-16-centos ~]# sudo yum install docker-ce docker-ce-cli containerd.io
Qcloud centos - AppStream                                                     4.0 kB/s | 4.3 kB
Qcloud centos - BaseOS                                                         43 kB/s | 3.9 kB
Qcloud centos - extras                                                        1.4 kB/s | 1.5 kB
EPEL for redhat/centos 8 - x86_64                                             4.3 kB/s | 4.7 kB
No match for argument: docker-ce
No match for argument: docker-ce-cli
No match for argument: containerd.io
Error: Unable to find a match

出現了以上問題,以為是新機器所以換了下源,結果是一樣
后來裝上依賴就OK了

sudo yum install -y yum-utils  device-mapper-persistent-data  lvm2
 
sudo yum-config-manager  --add-repo   https://download.docker.com/linux/centos/docker-ce.repo
 
sudo yum install docker-ce docker-ce-cli containerd.io

如果報了如下錯誤,說明版本錯誤

[root@VM-0-16-centos ~]# sudo yum install docker-ce docker-ce-cli containerd.io
Repository epel is listed more than once in the configuration
Docker CE Stable - x86_64                                         4.2 kB/s |  25 kB     00:05
Error:
 Problem: package docker-ce-3:19.03.12-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of                                            the providers can be installed
  - cannot install the best candidate for the job
  - package containerd.io-1.2.10-3.2.el7.x86_64 is filtered out by modular filtering
  - package containerd.io-1.2.13-3.1.el7.x86_64 is filtered out by modular filtering
  - package containerd.io-1.2.13-3.2.el7.x86_64 is filtered out by modular filtering
  - package containerd.io-1.2.2-3.3.el7.x86_64 is filtered out by modular filtering
  - package containerd.io-1.2.2-3.el7.x86_64 is filtered out by modular filtering
  - package containerd.io-1.2.4-3.1.el7.x86_64 is filtered out by modular filtering
  - package containerd.io-1.2.5-3.1.el7.x86_64 is filtered out by modular filtering
  - package containerd.io-1.2.6-3.3.el7.x86_64 is filtered out by modular filtering
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best cand                                           idate packages)

需要安裝新的

dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm

然后再進行接下去的步驟

sudo yum install docker-ce docker-ce-cli
 
sudo systemctl start docker

驗證一下,並加入開機啟動

OK~

2021年3月更新

今天安裝出現了其他問題

[root@iZsecbu3rrbxv0Z ~]# sudo yum install docker-ce docker-ce-cli containerd.io
Repository epel is listed more than once in the configuration
Last metadata expiration check: 0:41:34 ago on Mon 01 Mar 2021 09:20:10 AM CST.
Error:
 Problem: package moby-engine-20.10.3+azure-1.el7.x86_64 requires moby-containerd >= 1.3.9, but none of the providers can be installed
  - package moby-containerd-1.3.9+azure-1.x86_64 conflicts with containerd provided by containerd.io-1.4.3-3.1.el8.x86_64
  - package moby-containerd-1.4.3+azure-1.x86_64 conflicts with containerd provided by containerd.io-1.4.3-3.1.el8.x86_64
  - cannot install the best candidate for the job
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

這里需要刪除下etc/yum.repos.d/microsoft-prod.repo

[root@iZsecbu3rrbxv0Z ~]# cd /etc/yum.repos.d/
[root@iZsecbu3rrbxv0Z yum.repos.d]# rm -rf microsoft-prod.repo

再次安裝即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM