码迷,mamicode.com
首页 > 其他好文 > 详细

docker常用命令理解

时间:2019-05-14 00:53:33      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:mamicode   最大值   login   lin   orm   show   form   strong   example   

docker help
Commands: attach Attach local standard input, output, and error streams to a running container //重新进入一个运行的容器 build Build an image from a Dockerfile commit Create a new image from a container
s changes cp Copy files/folders between a container and the local filesystem create Create a new container diff Inspect changes to files or directories on a containers filesystem events Get real time events from the server exec Run a command in a running container export Export a containers filesystem as a tar archive history Show the history of an image images List images //列出本地的镜像 import Import the contents from a tarball to create a filesystem image info Display system-wide information inspect Return low-level information on Docker objects kill Kill one or more running containers load Load an image from a tar archive or STDIN login Log in to a Docker registry logout Log out from a Docker registry logs Fetch the logs of a container pause Pause all processes within one or more containers port List port mappings or a specific mapping for the container ps List containers pull Pull an image or a repository from a registry push Push an image or a repository to a registry rename Rename a container restart Restart one or more containers rm Remove one or more containers //删除容器 rmi Remove one or more images //docker rmi -f 镜像名称 run Run a command in a new container save Save one or more images to a tar archive (streamed to STDOUT by default) search Search the Docker Hub for images start Start one or more stopped containers stats Display a live stream of container(s) resource usage statistics stop Stop one or more running containers tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE top Display the running processes of a container unpause Unpause all processes within one or more containers update Update configuration of one or more containers version Show the Docker version information wait Block until one or more containers stop, then print their exit codes Run docker COMMAND --help for more information on a command.

 技术图片

技术图片

技术图片

docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

 

OPTIONS说明:
-a stdin: 指定标准输入输出内容类型,可选 STDIN/STDOUT/STDERR 三项;
-d: 后台运行容器,并返回容器ID;
-i: 以交互模式运行容器,通常与 -t 同时使用;
-p: 端口映射,格式为:主机(宿主)端口:容器端口
-t: 为容器重新分配一个伪输入终端,通常与 -i 同时使用;
--name="nginx-lb": 为容器指定一个名称;
--dns 8.8.8.8: 指定容器使用的DNS服务器,默认和宿主一致;
--dns-search example.com: 指定容器DNS搜索域名,默认和宿主一致;
-h "mars": 指定容器的hostname;
-e username="ritchie": 设置环境变量;
--env-file=[]: 从指定文件读入环境变量;
--cpuset="0-2" or --cpuset="0,1,2": 绑定容器到指定CPU运行;
-m :设置容器使用内存最大值;
--net="bridge": 指定容器的网络连接类型,支持 bridge/host/none/container: 四种类型;
--link=[]: 添加链接到另一个容器;
--expose=[]: 开放一个端口或一组端口;


ctrl+p+q:容器不停止而退出
exit:停止并退出容器
docker attach ...id 重新进入未关闭的容器

技术图片

 


docker镜像    联合文件系统    以tomcat为例

 

docker常用命令理解

标签:mamicode   最大值   login   lin   orm   show   form   strong   example   

原文地址:https://www.cnblogs.com/ustc-anmin/p/10859884.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!