docker命令概览

以前,使用docker的时候没有经过一个比较系统的学习,后续将会从docker命令到docker相关的各种知识梳理一下。先来看看docker相关的命令集合,使用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 container's filesystem
  events      Get real time events from the server
  exec        Run a command in a running container
  export      Export a container's 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
  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

对应命令作用如下:
1、docker attach :当前shell下attach连接指定运行镜像。
2、docker build : 通过dockerfile定制镜像。
3、docker commit :提交当前容器为新的镜像。
4、docker cp : 从容器中拷贝指定文件或者目录到主机中。
5、 docker create : 创建一个新的容器,但是不启动容器。
6、 docker diff : 查看容器变化。
7、 docker events : 从docker服务获取容器实时事件。
8、docker exec : 在已经存在的容器上运行命令。
9、 docker export : 导出容器的内容作为一个tar归档文件【和import对应】
10、docker history : 展示一个镜像形成历史
例子:

$ docker history hub.c.163.com/public/ubuntu:16.04-tools
IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
1196ea15dad6        6 months ago        /bin/sh -c #(nop)  CMD ["/usr/bin/supervis...   0B
<missing>           6 months ago        /bin/sh -c #(nop) COPY file:32c4496c7e250e...   70B
<missing>           6 months ago        /bin/sh -c #(nop)  EXPOSE 22/tcp                0B
<missing>           6 months ago        /bin/sh -c cp -f /usr/share/zoneinfo/Asia/...   414B
<missing>           6 months ago        /bin/sh -c sed -i s/"PermitRootLogin witho...   2.53kB
<missing>           6 months ago        /bin/sh -c apt-get update     && apt-get u...   112MB
<missing>           7 months ago        /bin/sh -c mkdir -p /var/run/sshd               0B
<missing>           7 months ago        /bin/sh -c #(nop)  MAINTAINER netease "ops"     0B
<missing>           20 months ago       /bin/sh -c #(nop) CMD ["/usr/sbin/sshd" "-D"]   0B
<missing>           20 months ago       /bin/sh -c #(nop) EXPOSE 22/tcp                 0B
<missing>           20 months ago       /bin/sh -c sed -ri 's/^#PasswordAuthentica...   2.54kB
<missing>           20 months ago       /bin/sh -c mkdir /var/run/sshd                  0B
<missing>           20 months ago       /bin/sh -c apt-get install -y openssh-serv...   83.5MB
<missing>           20 months ago       /bin/sh -c apt-get update                       22.4MB
<missing>           20 months ago       /bin/sh -c #(nop) CMD ["/bin/bash"]             0B
<missing>           20 months ago       /bin/sh -c sed -i 's/^#\s*\(deb.*universe\...   1.9kB
<missing>           20 months ago       /bin/sh -c echo '#!/bin/sh' > /usr/sbin/po...   701B
<missing>           20 months ago       /bin/sh -c #(nop) ADD file:9ade4e2863c54c6...   118MB

11、docker images : 列出系统当前所有镜像。
12、docker import : 从tar包中的内容插件一个新的文件系统映像【对应export】
13、docker info : 显示docker系统相关信息
14、docker inspect : 查看容器信息信息
15、docker kill : kill指定docker容器
16、docker load : 从一个tar包中加载一个镜像【对应 save】
17、docker login : 注册或者登陆一个docker源服务器
18、docker logout : 从当前docker registry退出
19、docker logs : 输出指定容器日志信息
20、docker port : 查看映射端口对应的容器内部源端口
21、docker pause : 暂停指定容器
22、docker ps : 列出正在运行的容器列表
23、docker pull : 从镜像源服务器获取指定镜像或者库镜像
24、docker push : 推送指定镜像的活着库镜像到docker源服务器
25、docker restart : 重启一个指定的正在运行的容器。
26、docker rm : 移除一个或者多个容器
27、docker rmi: 移除一个或者多个镜像【无容器使用该镜像才可以删除,否则需要关闭相关容器才可继续活-f强制删除】
28、docker run : 创建一个新的容器并运行一个命令
29、docker save : 保存一个镜像为一个tar包【对应load】
30、docker search : 在docker hub中搜索镜像
31、docker start : 启动容器
32、docker stop : 停止容器
33、docker tag : 给源镜像打标签
34、docker top : 查看容器运行的进程信息
35、docker unpause : 取消暂停容器
36、docker version : 查看docker版本信息
37、docker wait : 获取容器停止是的退出状态值

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值