在阿里雲服務器上安裝Docker,服務器的系統是CentOS 7.6,
所以可以看官方Docker安裝文檔:https://docs.docker.com/install/linux/docker-ce/centos/
從閱讀官網來看,首先若是沒有較舊的Docker版本只需3步就可以完成Dockers的安裝;但是有舊版本的話,需要先卸載舊版本
$ sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
無舊版本時(3步)
1.安裝所需的軟件包
$ sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
2.配置阿里雲Docker Yum源(個人覺的好)
$ sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3.安裝最新版本的Docker
$ sudo yum install docker-ce docker-ce-cli containerd.io
這樣之后就OK了,執行啟動Docker的命令:systemctl start docker,然后走一波,完美!!
注,重要的事情說三遍。大多數人的執行完第二步后,會出現以下錯誤 Loaded plugins: fastestmirror
解決方法如下:
1、
# vi /etc/yum/pluginconf.d/fastestmirror.conf
enabled=0 //由 1 改成0 ,禁用該插件
verbose=0
always_print_best_host = true
socket_timeout=3
# Relative paths are relative to the cachedir (and so works for users as well
# as root).
hostfilepath=timedhosts.txt
maxhostfileage=10
maxthreads=15
#exclude=.gov, facebook
#include_only=.nl,.de,.uk,.ie
2、
#vi /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1 #將plugins的值修改為0
installonly_limit=5
3、
$ yum clean dbcache
