@Gatsby ➜ blog git(master) ✗ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES bc82d9e95ae3 docker/getting-started "/docker-entrypoint.…" 11 seconds ago Up 10 seconds 0.0.0.0:80->80/tcp stupefied_zhukovsky @Gatsby ➜ blog git(master) ✗ 0.0.0.0:80->80/tcp stupefied_zhukovsky
关闭和启动容器
docker的run,start,stop,restart四种操作中只有run会实例化容器
1
docker [start|stop|restart] <constainer id|name>
镜像相关
列出本地镜像
1 2 3 4
@Gatsby ➜ ~ docker images REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu 16.04 dfeff22e96ae 3 days ago 131MB docker/getting-started latest 1f32459ef038 3 months ago 26.8MB
搜索镜像
1 2 3 4
@Gatsby ➜ ~ docker search python NAME DESCRIPTION STARS OFFICIAL AUTOMATED python Python is an interpreted, interactive, objec… 5574 [OK]
实例化镜像
1 2 3 4
@Gatsby ➜ blog git(master) ✗ docker run -d -p 80:80 docker/getting-started Unable to find image 'docker/getting-started:latest' locally latest: Pulling from docker/getting-started ...
参数说明
-d 后台运行
-p 端口映射
:tag-name 镜像标签
1 2 3 4 5 6 7 8
@Gatsby ➜ ~ docker run -it -p 80:80 docker/getting-started /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh 10-listen-on-ipv6-by-default.sh: Getting the checksum of /etc/nginx/conf.d/default.conf 10-listen-on-ipv6-by-default.sh: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh /docker-entrypoint.sh: Configuration complete; ready for start up