玩转Docker之安装篇(二)

原文地址: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/
posted @ 2016-08-25 16:06  积蕴  阅读(1985)  评论(2编辑  收藏  举报