阿里云Ubuntu 16.04 LTS 64位系統(tǒng)安裝Docker-CE
Docker CE(Community Edition),即Docker社區(qū)版,是開發(fā)人員和小型團隊的理想選擇。
step 1: 安裝必要的一些系統(tǒng)工具
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
step 2: 安裝GPG證書
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
Step 3: 寫入軟件源信息
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
Step 4: 更新并安裝Docker-CE
sudo apt-get -y update
sudo apt-get -y install docker-ce
上面命令默認安裝最新版本,若想安裝指定版本的Docker-CE:
Step 4.1: 查找Docker-CE的版本:
apt-cache madison docker-ce
Step 4.2: 安裝指定版本的Docker-CE: (把下面VERSION改成指定版本即可)
sudo apt-get -y install docker-ce=[VERSION]
Step 5: 查看docker是否啟動
systemctl status docker
Step 6: 若未啟動,則啟動docker服務
sudo systemctl start docker

Step 7: 永遠的hello world ==> run hello world驗證
sudo docker run hello-world
如出現(xiàn)下圖,則證明安裝成功。

可能遇到的問題:
問題1:
Err:2 https://download.docker.com/linux/ubuntu xenial/stable amd64 docker-ce-cli amd64 5:19.03.53-0ubuntu-xenial
Operation too slow. Less than 10 bytes/sec transferred the last 120 seconds
Err:3 https://download.docker.com/linux/ubuntu xenial/stable amd64 docker-ce amd64 5:19.03.53-0ubuntu-xenial
Could not resolve host: download.docker.com E: Failed to fetch https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/containerd.io_1.2.10-3_amd64.deb Operation too slow. Less than 10 bytes/sec transferred the last 120 seconds
E: Failed to fetch https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/docker-ce-cli_19.03.53-0ubuntu-xenial_amd64.deb Operation too slow. Less than 10 bytes/sec transferred the last 120 seconds
E: Failed to fetch https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/docker-ce_19.03.53-0ubuntu-xenial_amd64.deb Could not resolve host: download.docker.com
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
原因:外網(wǎng)鏡像源下載速度慢?
解決方法:更換國內阿里云證書和軟件源,如上面step2和step3所示。
問題2:運行sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common出現(xiàn)
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
原因:其他過程正在占用apt,找到該進程殺死即可
解決方法:
ps aux | grep -i apt
運行上面命令查看占用apt的進程id
使用sudo kill -9 <進程ID>或sudo killall apt-get殺死進程即可。
參考:
https://help.aliyun.com/document_detail/60742.html
https://blog.csdn.net/BingZhongDeHuoYan/article/details/79411479