原文地址:http://accjiyun.cn/wan-zhuan-dockerzhi-an-zhuang-pian-er/
按理說,安裝軟件最好是按照官方文檔進行,但由於國內網絡的局限性,使我們不得不搭梯子,但終究太麻煩。鑒於此情況,我推薦
方案一
,利用某公司的加速站點來安裝,而且是傻瓜式的,非常方便。
方案一:
在linux主機上執行下面一條命令即可(若沒有linux實體機,可以使用虛擬機搭建linux環境)。
curl -sSL https://get.daocloud.io/docker | sh
命令執行成功后,若出現下面字符,則安裝成功了。
Client:
Version: 1.10.1
API version: 1.22
Go version: go1.5.3
Git commit: 9e83765
Built: Thu Feb 11 19:32:54 2016
OS/Arch: linux/amd64
Server:
Version: 1.10.1
API version: 1.22
Go version: go1.5.3
Git commit: 9e83765
Built: Thu Feb 11 19:32:54 2016
OS/Arch: linux/amd64
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
sudo usermod -aG docker your-user
Remember that you will have to log out and back in for this to take effect!
方案二:
這是官方提供的安裝步驟,但前提是你搭好了梯子。
1.檢查你的系統里curl
是否安裝了。
which curl
如果curl
沒有安裝,就先更新你的軟件包索引,然后安裝curl
。
sudo apt-get update
sudo apt-get install curl
2.獲取最新的Docker軟件包。
curl -fsSL https://get.docker.com/ | sh
然后系統會提示你輸入root賬號的密碼。
curl -fsSL https://get.docker.com/gpg | sudo apt-key add -
3.確認docker是否成功的安裝了。
docker run hello-world
反饋如下,則安裝成功。
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
535020c3e8ad: Pull complete
af340544ed62: Pull complete
Digest: sha256:a68868bfe696c00866942e8f5ca39e3e31b79c1e50feaee4ce5e28df2f051d5c
Status: Downloaded newer image for hello-world:latest
Hello from Docker.
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker Engine CLI client contacted the Docker Engine daemon.
2. The Docker Engine daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker Engine daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker Engine daemon streamed that output to the Docker Engine CLI client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker Hub account:
https://hub.docker.com
For more examples and ideas, visit:
https://docs.docker.com/userguide/