docker version Client: Docker Engine - Community Version: 18.09.2 API version: 1.39 Go version: go1.10.8 Git commit: 6247962 Built: Sun Feb 10 04:12:39 2019 OS/Arch: darwin/amd64 Experimental: false
Server: Docker Engine - Community Engine: Version: 18.09.2 API version: 1.39 (minimum version 1.12) Go version: go1.10.6 Git commit: 6247962 Built: Sun Feb 10 04:13:06 2019 OS/Arch: linux/amd64 Experimental: false
拉取镜像
执行命令docker pull hello-world
1 2 3 4
docker pull hello-world Using default tag: latest Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting forconnection (Client.Timeout exceeded while awaiting headers)
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. (amd64) 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://hub.docker.com/
For more examples and ideas, visit: https://docs.docker.com/get-started/
运行Nginx镜像
拉取镜像
1 2 3 4 5 6 7 8
docker pull hub.c.163.com/library/nginx Using default tag: latest latest: Pulling from library/nginx 5de4b4d551f8: Pull complete d4b36a5e9443: Pull complete 0af1f0713557: Pull complete Digest: sha256:f84932f738583e0169f94af9b2d5201be2dbacc1578de73b09a6dfaaa07801d6 Status: Downloaded newer image for hub.c.163.com/library/nginx:latest
运行镜像
1 2
docker run -d hub.c.163.com/library/nginx 89979036016d6d09b5cf072e4ad72069e83c0c19929d439233393d0610eefb89
查看运行的容器
1 2 3
docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 89979036016d hub.c.163.com/library/nginx "nginx -g 'daemon of…" 2 minutes ago Up 2 minutes 80/tcp epic_thompson