參考官方文檔:https://docs.docker.com/engine/installation/linux/ubuntu/
1. 安裝一些使 apt 可以使用 https 的源
sudo apt-get install -y --no-install-recommends \ apt-transport-https \ ca-certificates \ curl \ software-properties-common
2. 添加docker 官方 GPG key:
curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add -
3. 使用穩定的倉庫 (紅色字體是mint與ubuntu官方版本不一致的地方,在官方參考文檔也有說明)
sudo add-apt-repository \ "deb https://apt.dockerproject.org/repo/ \ ubuntu-trusty \ main"
4. 安裝docker
sudo apt-get update
sudo apt-get -y install docker-engine
備注:
安裝錯誤情況:
下列軟件包有未滿足的依賴關系:
docker-engine : 依賴: libsystemd-journal0 (>= 201) 但無法安裝它
E: 無法修正錯誤,因為您要求某些軟件包保持現狀,就是它們破壞了軟件包間的依賴關系。
解決:
添加源 sudo add-apt-repository "deb http://cz.archive.ubuntu.com/ubuntu trusty main"