hub.docker.com -----docker遠(yuǎn)程倉(cāng)庫(kù)
切勿在沒(méi)有配置 Docker APT 源的情況下直接使用 apt 命令安裝 Docker
系統(tǒng)要求
Docker CE 支持以下版本的 Ubuntu 操作系統(tǒng):(CE 代表社區(qū)版 免費(fèi)的)
- Artful 17.10 (Docker CE 17.11 Edge +)
- Xenial 16.04 (LTS)
- Trusty 14.04 (LTS)
Docker CE 可以安裝在 64 位的 x86 平臺(tái)或 ARM 平臺(tái)上胶台。Ubuntu 發(fā)行版中尝江,LTS(Long-Term-Support)長(zhǎng)期支持版本阵难,會(huì)獲得 5 年的升級(jí)維護(hù)支持鞋喇,這樣的版本會(huì)更穩(wěn)定肌割,因此在生產(chǎn)環(huán)境中推薦使用 LTS 版本,當(dāng)前最新的 LTS 版本為 Ubuntu 16.04卧蜓。(最低要求16.04)
使用APT安裝Docker
1.安裝必要的一些系統(tǒng)工具
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
apt-get update出現(xiàn)如下異常時(shí)
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
執(zhí)行:ps -A | grep apt 殺死apt進(jìn)程
2.安裝 GPG 證書(shū)
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
3.寫(xiě)入軟件源信息
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
4.更新并安裝 Docker CE
sudo apt-get -y update
sudo apt-get -y install docker-ce
啟動(dòng) Docker CE
systemctl enable docker
systemctl start docker
鏡像加速
鑒于國(guó)內(nèi)網(wǎng)絡(luò)問(wèn)題,后續(xù)拉取 Docker 鏡像十分緩慢把敞,強(qiáng)烈建議安裝 Docker 之后配置 國(guó)內(nèi)鏡像加速弥奸。
對(duì)于使用 systemd 的系統(tǒng),請(qǐng)?jiān)?/etc/docker/daemon.json 中寫(xiě)入如下內(nèi)容(如果文件不存在請(qǐng)新建該文件)
{
"registry-mirrors": [
"https://registry.docker-cn.com"
]
}
注意奋早,一定要保證該文件符合 json 規(guī)范其爵,否則 Docker 將不能啟動(dòng)
之后重新啟動(dòng)服務(wù)
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker