Ubuntu 16.04 安裝 Docker
Step.1 先 update 你的 package
$ sudo apt-get update
Step.2 加入 Docker 的官方 repository 金鑰
$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
Step.3 加入 Docker 官方 repository
$ sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
Step.4 更新 repository
$ sudo apt-get update
Step.5 用 apt-cache 搜尋一下 docker-engine,確保你是從 Docker 官方 repository 安裝的,而不是 Ubuntu repository
$ apt-cache policy docker-engine
docker-engine:
Installed: (none)
Candidate: 1.13.0-0~ubuntu-xenial
Version table:
1.13.0-0~ubuntu-xenial 500
500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
1.12.6-0~ubuntu-xenial 500
500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
1.12.5-0~ubuntu-xenial 500
500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
1.12.4-0~ubuntu-xenial 500
500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
1.12.3-0~xenial 500
500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
1.12.2-0~xenial 500
500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
1.12.1-0~xenial 500
500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
1.12.0-0~xenial 500
500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
1.11.2-0~xenial 500
500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
1.11.1-0~xenial 500
500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
1.11.0-0~xenial 500
500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
來源必須是 https://apt.dockerproject.org。
Step.6 安裝 Docker
$ sudo apt-get install -y docker-engine
Step.7 Docker 會自動將服務啟動,並且寫入 boot
$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2017-02-05 03:11:07 CST; 13s ago
Docs: https://docs.docker.com
Main PID: 3155 (dockerd)
CGroup: /system.slice/docker.service
├─3155 /usr/bin/dockerd -H fd://
└─3164 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --
Step.8 由於這樣裝起來如果你要使用 docker command line 的話都必須使用 sudo 執行,如果不想要再用 sudo 的話可以將使用者加入 docker group
$ sudo usermod -aG docker $(whoami)
如果要馬上生效,請重新登入。
可以開始搜尋 image 享受你的 Docker 囉 :)
參考資料:
How To Install and Use Docker on Ubuntu 16.04
Orignal From: Ubuntu 16.04 安裝 Docker engine
沒有留言:
張貼留言