亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

Docker命令-docker ps

標簽:
Docker

docker ps

原文

描述

列出docker容器。

选项

名称默认描述
--all, -a
列出所有容器,默认显示运行中的容器
--filter, -f
根据条件过滤显示内容
--format
通过模板展示容器信息
--last, -n-1显示最近创建的n个容器(包含所有容器状态)
--latest, -l
显示最近创建的容器(包含所有容器状态)
--no-trunc
不截断输出
--quiet, -q
'静默模式',只展示容器ID
--size, -s
显示容器总的文件大小

使用示例

  1. 一般使用

$ docker ps
$ docker ps -a
  1. filter使用

$ docker ps --filter name=nginx
$ docker ps -a --filter exited=0$ docker ps --filter status=running
$ docker ps --filter expose=3306
  1. format使用

$ docker ps --format "{{.ID}}: {{.Names}}: {{.Command}}"a6bb8030cefc: zk2181: "/docker-entrypoint.…"f3dbb867fe91: mysql: "docker-entrypoint.s…"

更多参数参考

  • filter使用参数

FilterDescription
idContainer’s ID
nameContainer’s name
labelAn arbitrary string representing either a key or a key-value pair. Expressed as <key> or <key>=<value>
exitedAn integer representing the container’s exit code. Only useful with --all.
statusOne of created, restarting, running, removing, paused, exited, or dead
ancestorFilters containers which share a given image as an ancestor. Expressed as <image-name>[:<tag>],<image id>, or <image@digest>
before or sinceFilters containers created before or after a given container ID or name
volumeFilters running containers which have mounted a given volume or bind mount.
networkFilters running containers connected to a given network.
publish or exposeFilters containers which publish or expose a given port. Expressed as <port>[/<proto>] or <startport-endport>/[<proto>]
healthFilters containers based on their healthcheck status. One of starting, healthy, unhealthy or none.
isolationWindows daemon only. One of default, process, or hyperv.
is-taskFilters containers that are a “task” for a service. Boolean option (true or false)
  • format

PlaceholderDescription
.IDContainer ID
.ImageImage ID
.CommandQuoted command
.CreatedAtTime when the container was created.
.RunningForElapsed time since the container was started.
.PortsExposed ports.
.StatusContainer status.
.SizeContainer disk size.
.NamesContainer names.
.LabelsAll labels assigned to the container.
.LabelValue of a specific label for this container. For example '{{.Label "com.docker.swarm.cpu"}}'
.MountsNames of the volumes mounted in this container.
.NetworksNames of the networks attached to this container.



作者:泥称已被栈用
链接:https://www.jianshu.com/p/3a69fe0a9c41


點擊查看更多內容
TA 點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優質文章

正在加載中
  • 推薦
  • 評論
  • 收藏
  • 共同學習,寫下你的評論
感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學

大額優惠券免費領

立即參與 放棄機會
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

舉報

0/150
提交
取消