参考:官网
安装依赖包:
$ sudo apt-get update
$ sudo apt-get install -y --no-install-recommends
linux-image-extra-$(uname -r)
linux-image-extra-virtual
Install using the repository
1.Install packages to allow apt to use a repository over HTTPS:
sudo apt-get install -y --no-install-recommends
apt-transport-https
ca-certificates
curl
software-properties-common
2.Add Docker’s official GPG key:
curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add -
Verify that the key ID is 58118E89F3A912897C070ADBF76221572C52609D.
apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D
pub 4096R/2C52609D 2015-07-14
Key fingerprint = 5811 8E89 F3A9 1289 7C07 0ADB F762 2157 2C52 609D
uid Docker Release Tool (releasedocker) <docker@docker.com>
3.Use the following command to set up the stable repository.
sudo add-apt-repository
"deb https://apt.dockerproject.org/repo/
ubuntu-$(lsb_release -cs)
main"
4.Install Docker
sudo apt-get update
sudo apt-get -y install docker-engine
5.Verify Docker
root@ubuntu:/home/wasdns# docker -v
Docker version 1.13.1, build 092cba3
sudo docker run hello-world
root@ubuntu:/home/wasdns# sudo docker run hello-worldUnable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
78445dd45222: Pull complete
Digest: sha256:7820f4620e6cf3e795643fac2f6b09e7fd0a29e7e5c4eee6aac9ba0bedca158c
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/
2017/2/16