deb https://apt.dockerproject.org/repo ubuntu-xenial main
执行命令添加源
1
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
更新源
1
sudo apt-get update
查看可安装列表(这步可以略过)
1
apt-cache policy docker-engine
安装 默认安装最近的版本
1
sudo apt-get install docker-engine
启动
1
sudo service docker start
运行hello world
1
sudo docker run hello-world
结果:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: The Docker client contacted the Docker daemon. The Docker daemon pulled the “hello-world” image from the Docker Hub. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 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 Hub account: https://hub.docker.com For more examples and ideas, visit: https://docs.docker.com/engine/userguide/