一、查看docker可运行的命令

[docker@localhost/]$ docker  --help
 
Commands:
   attach    Attach to a runningcontainer #当前 shell下 attach 连接指定运行镜像
   build     Build an image from aDockerfile #通过 Dockerfile定制镜像
   commit    Create a new image froma container's changes #提交当前容器为新的镜像
   cp        Copy files/folders fromthe containers filesystem to the host path
              #从容器中拷贝指定文件或者目录到宿主机中
   create    Create a newcontainer   #创建一个新的容器,同 run,但不启动容器
   diff      Inspect changes on acontainer's filesystem   #查看 docker 容器变化
   events    Get real time eventsfrom the server #从 docker服务获取容器实时事件
   exec      Run a command in anexisting container       #在已存在的容器上运行命令
   export    Stream the contents of acontainer as a tar archive  
              #导出容器的内容流作为一个tar归档文件[对应 import ]
   history   Show the history of animage                  #展示一个镜像形成历史
   images    List images                                   #列出系统当前镜像
   import    Create a new filesystemimage from the contents of a tarball 
              #从tar包中的内容创建一个新的文件系统映像[对应 export]
   info      Display system-wideinformation               #显示系统相关信息
   inspect   Return low-levelinformation on a container   #查看容器详细信息
   kill      Kill a runningcontainer                      # kill指定 docker 容器
   load      Load an image from a tararchive              #从一个 tar 包中加载一个镜像[对应 save]
   login     Register or Login to thedocker registry server  
              #注册或者登陆一个 docker源服务器
   logout    Log out from a Dockerregistry server         #从当前 Docker registry退出
   logs      Fetch the logs of acontainer                 #输出当前容器日志信息
   port      Lookup the public-facingport which is NAT-ed to PRIVATE_PORT
              #查看映射端口对应的容器内部源端口
   pause     Pause all processeswithin a container        #暂停容器
   ps        List containers                               #列出容器列表
   pull      Pull an image or arepository from the docker registry server
              #从docker镜像源服务器拉取指定镜像或者库镜像
   push      Push an image or arepository to the docker registry server
              #推送指定镜像或者库镜像至docker源服务器
   restart   Restart a runningcontainer                   #重启运行的容器
   rm        Remove one or morecontainers                 #移除一个或者多个容器
   rmi       Remove one or moreimages                
              #移除一个或多个镜像[无容器使用该镜像才可删除,否则需删除相关容器才可继续或 -f强制删除]
   run       Run a command in a newcontainer
              #创建一个新的容器并运行一个命令
   save      Save an image to a tararchive                #保存一个镜像为一个 tar包[对应 load]
   search    Search for an image onthe Docker Hub         #在 docker hub中搜索镜像
   start     Start a stoppedcontainers                    #启动容器
   stop      Stop a runningcontainers                     #停止容器
   tag       Tag an image into arepository                #给源中镜像打标签
   top       Lookup the runningprocesses of a container   #查看容器中运行的进程信息
   unpause   Unpause a pausedcontainer                    #取消暂停容器
   version   Show the docker versioninformation           #查看 docker 版本号
   wait      Block until a containerstops, then print its exit code  
              #截取容器停止时的退出状态值
Run 'docker COMMAND --help' for moreinformation on a command.


 

二、查看docker版本

[docker@localhost/]$ docker  version

三、搜索images

[docker@localhost/]$ docker search ubuntu

四、查看本地镜像

[docker@localhost/]$ docker images

五、查看当前运行容器

[docker@localhost/]$ docker ps –a

六、运行镜像

[docker@localhost/]$ docker run hello-world

七、docker调整运行状态

dockerstart|stop|kill|restart|pause|unpause|rm|commit|inspect|logs
dockerstart CONTAINER [CONTAINER...]
# 运行一个或多个停止的容器
dockerstop CONTAINER [CONTAINER...]
# 停掉一个或多个运行的容器-t选项可指定超时时间
dockerkill [OPTIONS] CONTAINER [CONTAINER...]
# 默认 kill 发送 SIGKILL 信号-s可以指定发送 kill 信号类型
dockerrestart [OPTIONS] CONTAINER [CONTAINER...]
# 重启一个或多个运行的容器-t选项可指定超时时间
dockerpause CONTAINER
# 暂停一个容器,方便 commit
dockerunpause CONTAINER
# 继续暂停的容器
dockerrm [OPTIONS] CONTAINER [CONTAINER...]
# 移除一个或多个容器
-f, --force=false Force removal ofrunning container
-l, --link=false Remove the specifiedlink and not the underlying container
-v, --volumes=false Remove the volumesassociated with the container
dockercommit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
# 提交指定容器为镜像
-a, --author="" Author (e.g.,"John Hannibal Smith hannibal@a-team.com")
-m, --message="" Commitmessage
-p, --pause=true Pause container duringcommit
# 默认 commit 是暂停状态
dockerinspect CONTAINER|IMAGE [CONTAINER|IMAGE...]
# 查看容器或者镜像的详细信息
dockerlogs CONTAINER
# 输出指定容器日志信息
-f, --follow=false Follow log output
# 类似 tail -f
-t, --timestamps=false Show timestamps
--tail="all" Output thespecified number of lines at the end of logs (defaults to all logs)


八、一张图总结 Docker 的命令


docker volume怎么查看 docker command 查看_Docker