在终端中执行如下命令安装:linux
$ curl -sSL https://get.daocloud.io/docker | sh
出现如下内容,说明安装成功了:git
Client: Version: 17.04.0-ce API version: 1.28 Go version: go1.7.5 Git commit: 4845c56 Built: Mon Apr 3 18:07:42 2017 OS/Arch: linux/amd64 Server: Version: 17.04.0-ce API version: 1.28 (minimum version 1.12) Go version: go1.7.5 Git commit: 4845c56 Built: Mon Apr 3 18:07:42 2017 OS/Arch: linux/amd64 Experimental: false 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 zhangdaofeng Remember that you will have to log out and back in for this to take effect!
确认docker是否成功安装了:github
$ sudo docker run hello-world
反馈以下,则安装成功。docker
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 78445dd45222: Pull complete Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7 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 client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker 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 ID: https://cloud.docker.com/ For more examples and ideas, visit: https://docs.docker.com/engine/userguide/
Docker Compose是一个用来定义和运行复杂应用的Docker工具。使用Compose,你能够在一个文件中定义一个多容器应用,而后使用一条命令来启动你的应用,完成一切准备工做。shell
一个使用Docker容器的应用,一般由多个容器组成。使用Docker Compose,再也不须要使用shell脚原本启动容器。在配置文件中,全部的容器经过services来定义,而后使用docker-compose脚原本启动、中止和重启应用,以及应用中的服务以及全部依赖服务的容器。ubuntu
运行下面的命令来安装 Compose:bash
curl -L https://github.com/docker/compose/releases/download/1.12.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose
**注意:**若是你在安装的时候出现了 “Permission denied” 的错误信息,这说明你的 /usr/local/bin 目录是不可写的,你须要使用超级用户来安装。运行 sudo -i , 而后运行上边的两个命令,而后 exit 退出。app
也能够使用pip
安装:curl
$ sudo pip install -U docker-compose
到这里安装就结束了;Compose已经安装完成。你能够使用 docker-compose --version
来进行测试。ide