kubernetes基础之docker常用命令

docker常用命令

最近应一个老朋友的邀请,整理一下docker的命令,在之后的章节会把每个命令都详细讲述一遍,随便在之后的篇章里面总结一下kubernetes

docker常用命令系统解释主要功能作用
attachAttach local standard input, output, and error streams to a running container连接到一个正在运行的容器
buildBuild an image from a Dockerfile通过dockerfile来创建一个容器
commitCreate a new image from a container’s changes通过容器来创建一个新的镜像
cpCopy files/folders between a container and the local filesystem用于容器与主机之间的数据复制
createCreate a new container创建一个新的容器
diffInspect changes to files or directories on a container’s filesystem检查容器中哪些文件发生了变化
eventsGet real time events from the server从服务器上面获取实时事件
execRun a command in a running container在运行的容器中执行命令
exportExport a container’s filesystem as a tar archive将一个容器保存为tar文档
historyShow the history of an image展示一个镜像的操作历史
imagesList images列出当前所有镜像
importImport the contents from a tarball to create a filesystem image导入一个tar包创建一个系统镜像
infoDisplay system-wide information显示docker系统信息
inspectReturn low-level information on Docker objects获取容器/镜像的元数据
killKill one or more running containerskill掉一个或者多个运行的容器
loadLoad an image from a tar archive or STDIN导入使用docker save命令导出的镜像
loginLog in to a Docker registry登录到docker仓库
logoutLog out from a Docker registry登出
logsFetch the logs of a container查看docker日志
pausePause all processes within one or more containers暂停容器中的所有进程
portList port mappings or a specific mapping for the container列出指定容器的端口映射
psList containers列出容器
pullPull an image or a repository from a registry拉取镜像
pushPush an image or a repository to a registry上传一个镜像
renameRename a container重命名一个容器
restartRestart one or more containers重启一个或多个容器
rmRemove one or more containers移除一个或多个容器
rmiRemove one or more images移除一个或多个镜像
runRun a command in a new container创建一个容器
saveSave one or more images to a tar archive (streamed to STDOUT by default)将指定的镜像保存成tar包
searchSearch the Docker Hub for images从docker hub查找镜像
startStart one or more stopped containers开始一个或多个镜像
statsDisplay a live stream of container(s) resource usage statistics显示容器资源使用统计
stopStop one or more running containers停止一个或多个镜像
tagCreate a tag TARGET_IMAGE that refers to SOURCE_IMAGE标记本地镜像
topDisplay the running processes of a container查看容器中运行的进程
unpauseUnpause all processes within one or more containers恢复容器中所有的进程
updateUpdate configuration of one or more containers更新一个或多个容器的配置
versionShow the Docker version information显示docekr版本信息
waitBlock until one or more containers stop, then print their exit codes阻塞运行直到容器停止,然后打印出它的退出代码
[root@localhost ~]# docker --help   #通过--help来查看docker的所有命令

Usage:  docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Options:   #这个我们先不管
      --config string      Location of client config files (default "/root/.docker")
  -c, --context string     Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with
                           "docker context use")
  -D, --debug              Enable debug mode
  -H, --host list          Daemon socket(s) to connect to
  -l, --log-level string   Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
      --tls                Use TLS; implied by --tlsverify
      --tlscacert string   Trust certs signed only by this CA (default "/root/.docker/ca.pem")
      --tlscert string     Path to TLS certificate file (default "/root/.docker/cert.pem")
      --tlskey string      Path to TLS key file (default "/root/.docker/key.pem")
      --tlsverify          Use TLS and verify the remote
  -v, --version            Print version information and quit

Management Commands:  #这个是管理命令我们也先不管
  app*        Docker App (Docker Inc., v0.9.1-beta3)
  builder     Manage builds
  buildx*     Build with BuildKit (Docker Inc., v0.5.1-docker)
  config      Manage Docker configs
  container   Manage containers
  context     Manage contexts
  image       Manage images
  manifest    Manage Docker image manifests and manifest lists
  network     Manage networks
  node        Manage Swarm nodes
  plugin      Manage plugins
  secret      Manage Docker secrets
  service     Manage services
  stack       Manage Docker stacks
  swarm       Manage Swarm
  system      Manage Docker
  trust       Manage trust on Docker images
  volume      Manage volumes

Commands:  #这个就是我们要操心的啦
  attach      Attach local standard input, output, and error streams to a running container   #连接到一个正在运行的容器
  build       Build an image from a Dockerfile   #通过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   #将一个容器保存为tar文档
  history     Show the history of an image   #展示一个镜像的操作历史
  images      List images   #列出当前所有镜像
  import      Import the contents from a tarball to create a filesystem image   #导入一个tar包创建一个系统镜像
  info        Display system-wide information   #显示docker系统信息
  inspect     Return low-level information on Docker objects   #获取容器/镜像的元数据
  kill        Kill one or more running containers  #kill掉一个或者多个运行的容器
  load        Load an image from a tar archive or STDIN   #导入使用docker save命令导出的镜像
  login       Log in to a Docker registry  #登录到docker仓库
  logout      Log out from a Docker registry  #登出
  logs        Fetch the logs of a container   #查看docker日志
  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)   #将指定的镜像保存成tar包
  search      Search the Docker Hub for images   #从docker hub查找镜像
  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  #显示docekr版本信息
  wait        Block until one or more containers stop, then print their exit codes  #阻塞运行直到容器停止,然后打印出它的退出代码

Run 'docker COMMAND --help' for more information on a command.

To get more help with docker, check out our guides at https://docs.docker.com/go/guides/




评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

刘帅0952

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值