podman-pod-command

podman-pod-create

# podman pod create --infra --infra-command /pause --pod-id-file /tmp/podid --label red=blue  -p 123:123 --name shaju --infra-image docker.io/mirrorgooglecontainers/pause:3.1 --share cgroup,ipc,net,uts

# podman pod inspect pod-test
{
     "Config": {
          "id": "d1b8e33356733d454c659cdce8af66436ac5c1f7f471185854597ce2ed929ec9",
          "name": "pod-test",
          "labels": {
               "red": "blue"
          },
          "cgroupParent": "machine.slice",
          "sharesCgroup": true,
          "sharesIpc": true,
          "sharesNet": true,
          "sharesUts": true,
          "infraConfig": {
               "makeInfraContainer": true,
               "infraPortBindings": [
                    {
                         "hostPort": 123,
                         "containerPort": 123,
                         "protocol": "tcp",
                         "hostIP": ""
                    }
               ]
          },
          "created": "2019-01-23T23:11:16.289078759+08:00"
     },
     "State": {
          "cgroupPath": "machine.slice/machine-libpod_pod_d1b8e33356733d454c659cdce8af66436ac5c1f7f471185854597ce2ed929ec9.slice",
          "infraContainerID": "dbe36a258da0b79b69a8995f32d02b93190a2936b935918a84483b32d01259e5"
     },
     "Containers": [
          {
               "id": "dbe36a258da0b79b69a8995f32d02b93190a2936b935918a84483b32d01259e5",
               "state": "running"
          }
     ]
}

# cat /tmp/podid
d1b8e33356733d454c659cdce8af66436ac5c1f7f471185854597ce2ed929ec9

# podman ps -a | grep 123
dbe36a258da0  docker.io/mirrorgooglecontainers/pause:3.1                  About a minute ago  Up About a minute ago      0.0.0.0:123->123/tcp  d1b8e3335673-infra

# podman inspect dbe36a258da0 -f "{{.Config.Cmd}}"
[/pause]
# vi pod-label-file
green:yellow
black:white

# podman pod create --name="label-file-pod" --label-file pod-label-file

# podman pod inspect label-file-pod | grep -A 2 label
          "name": "label-file-pod",
          "labels": {
               "green:yellow": "",
               "black:white": ""

podman-pod-inspect

# podman pod create --name="latest-pod"
# podman pod inspect -l
{
     "Config": {
          "id": "8628b8a8ba8a7862428189c2c68bb4f7db8c0a64d3611902b4495876e6458975",
          "name": "latest-pod",
          "labels": null,
          "cgroupParent": "machine.slice",
          "sharesCgroup": true,
          "sharesIpc": true,
          "sharesNet": true,
          "sharesUts": true,
          "infraConfig": {
               "makeInfraContainer": true,
               "infraPortBindings": null
          },
          "created": "2019-01-23T23:20:34.477508536+08:00"
     },
     "State": {
          "cgroupPath": "machine.slice/machine-libpod_pod_8628b8a8ba8a7862428189c2c68bb4f7db8c0a64d3611902b4495876e6458975.slice",
          "infraContainerID": "c2beba4c5776598407f35bae10327ad2826781d10350d79c988fc4284de372aa"
     },
     "Containers": [
          {
               "id": "c2beba4c5776598407f35bae10327ad2826781d10350d79c988fc4284de372aa",
               "state": "running"
          }
     ]
}

podman-pod-ps

# podman pod ps -l
POD ID         NAME         STATUS    CREATED         # OF CONTAINERS   INFRA ID
8628b8a8ba8a   latest-pod   Running   4 minutes ago   1                 c2beba4c5776

# podman pod ps --ctr-ids --ctr-names --ctr-status --no-trunc --namespace --sort name
POD ID                                                             NAME             STATUS    CREATED          CGROUP          NAMESPACES           CONTAINER INFO                                                                                   INFRA ID
890fa658cde8f3d339786578b44e7087ff8b1c8da4d876a9e737f07d86506ae4   label-file-pod   Running   8 minutes ago    machine.slice   net,ipc,cgroup,uts   [529baa5a5267c88e2e98e6f6846414ff1596cca3c07af23f024112733a6a9666,890fa658cde8-infra,Running]    529baa5a5267c88e2e98e6f6846414ff1596cca3c07af23f024112733a6a9666
8628b8a8ba8a7862428189c2c68bb4f7db8c0a64d3611902b4495876e6458975   latest-pod       Running   5 minutes ago    machine.slice   net,ipc,cgroup,uts   [c2beba4c5776598407f35bae10327ad2826781d10350d79c988fc4284de372aa,8628b8a8ba8a-infra,Running]    c2beba4c5776598407f35bae10327ad2826781d10350d79c988fc4284de372aa
d1b8e33356733d454c659cdce8af66436ac5c1f7f471185854597ce2ed929ec9   pod-test         Running   14 minutes ago   machine.slice   net,ipc,cgroup,uts   [dbe36a258da0b79b69a8995f32d02b93190a2936b935918a84483b32d01259e5,d1b8e3335673-infra,Running]    dbe36a258da0b79b69a8995f32d02b93190a2936b935918a84483b32d01259e5

# podman pod ps --quiet
8628b8a8ba8a
890fa658cde8
d1b8e3335673

# podman pod ps --filter name=pod-test --format "{{.ID}}"
d1b8e3335673

podman-pod-stats

# podman pod stats --all --no-stream

POD            CID            NAME         CPU %  MEM USAGE/ LIMIT    MEM %  NET IO              BLOCK IO            PIDS
8628b8a8ba8a   c2beba4c5776   8628b8a8ba   6.02%  1.29MB / 8.339GB    0.02%  1.048kB / 5.922kB   -- / --             1
890fa658cde8   529baa5a5267   890fa658cd   3.06%  1.475MB / 8.339GB   0.02%  1.048kB / 8.748kB   -- / --             1
d1b8e3335673   dbe36a258da0   d1b8e33356   2.78%  1.327MB / 8.339GB   0.02%  1.118kB / 12.13kB   -- / --             1

# podman pod stats -l --no-reset --format "{{.MEM}}"
POD            CID            NAME         CPU %  MEM USAGE/ LIMIT    MEM %  NET IO              BLOCK IO            PIDS
8628b8a8ba8a   c2beba4c5776   8628b8a8ba   6.02%  1.29MB / 8.339GB    0.02%  1.048kB / 5.922kB   -- / --             1

POD            CID            NAME         CPU %  MEM USAGE/ LIMIT    MEM %  NET IO              BLOCK IO            PIDS
8628b8a8ba8a   c2beba4c5776   8628b8a8ba   6.02%  1.29MB / 8.339GB    0.02%  1.048kB / 5.922kB   -- / --             1
...

podman-pod-top

# podman pod top -l
USER   PID   PPID   %CPU    ELAPSED           TTY   TIME   COMMAND
0      1     0      0.000   11m9.903954276s   ?     0s     /pause

podman-pod-restart

# podman pod restart --all

# podman ps -a | grep pause
CONTAINER ID  IMAGE                                       COMMAND  CREATED         STATUS            PORTS                 NAMES
c2beba4c5776  docker.io/mirrorgooglecontainers/pause:3.1           11 minutes ago  Up 7 seconds ago                        8628b8a8ba8a-infra
529baa5a5267  docker.io/mirrorgooglecontainers/pause:3.1           15 minutes ago  Up 7 seconds ago                        890fa658cde8-infra
dbe36a258da0  docker.io/mirrorgooglecontainers/pause:3.1           21 minutes ago  Up 7 seconds ago  0.0.0.0:123->123/tcp  d1b8e3335673-infra

# podman pod restart -l
# podman ps -a | grep pause | grep seconds
c2beba4c5776  docker.io/mirrorgooglecontainers/pause:3.1           13 minutes ago  Up 17 seconds ago                            8628b8a8ba8a-infra

podman-pod-stop

# podman pod stop --all
# podman pod ps
POD ID         NAME             STATUS   CREATED          # OF CONTAINERS   INFRA ID
8628b8a8ba8a   latest-pod       Exited   15 minutes ago   1                 c2beba4c5776
890fa658cde8   label-file-pod   Exited   18 minutes ago   1                 529baa5a5267
d1b8e3335673   pod-test         Exited   24 minutes ago   1                 dbe36a258da0

# podman pod stop -l --timeout 3 等待调查

podman-pod-start

# podman pod start -l
# podman pod ps
POD ID         NAME             STATUS    CREATED          # OF CONTAINERS   INFRA ID
8628b8a8ba8a   latest-pod       Running   16 minutes ago   1                 c2beba4c5776
890fa658cde8   label-file-pod   Exited    19 minutes ago   1                 529baa5a5267
d1b8e3335673   pod-test         Exited    26 minutes ago   1                 dbe36a258da0

# podman pod start --all
# podman pod ps
POD ID         NAME             STATUS    CREATED          # OF CONTAINERS   INFRA ID
8628b8a8ba8a   latest-pod       Running   17 minutes ago   1                 c2beba4c5776
890fa658cde8   label-file-pod   Running   20 minutes ago   1                 529baa5a5267
d1b8e3335673   pod-test         Running   26 minutes ago   1                 dbe36a258da0

podman-pod-pause

# podman pod pause -l
# podman pod ps -l
POD ID         NAME         STATUS   CREATED          # OF CONTAINERS   INFRA ID
8628b8a8ba8a   latest-pod   Paused   22 minutes ago   1                 c2beba4c5776

# podman pod pause --all
# podman pod ps
POD ID         NAME             STATUS   CREATED          # OF CONTAINERS   INFRA ID
8628b8a8ba8a   latest-pod       Paused   22 minutes ago   1                 c2beba4c5776
890fa658cde8   label-file-pod   Paused   26 minutes ago   1                 529baa5a5267
d1b8e3335673   pod-test         Paused   32 minutes ago   1                 dbe36a258da0

podman-pod-unpause

# podman pod unpause -l
# podman ps -l
CONTAINER ID  IMAGE                                       COMMAND  CREATED         STATUS            PORTS  NAMES
c2beba4c5776  docker.io/mirrorgooglecontainers/pause:3.1           23 minutes ago  Up 6 minutes ago         8628b8a8ba8a-infra

# podman pod unpause --all
# podman pod ps
POD ID         NAME             STATUS    CREATED          # OF CONTAINERS   INFRA ID
8628b8a8ba8a   latest-pod       Running   23 minutes ago   1                 c2beba4c5776
890fa658cde8   label-file-pod   Running   27 minutes ago   1                 529baa5a5267
d1b8e3335673   pod-test         Running   33 minutes ago   1                 dbe36a258da0

podman-pod-exists

# podman pod exists pod-fake
# echo $?
1

# podman pod exists pod-test
# echo $?
0

podman-pod-kill

# podman pod kill -l
# podman ps -l
CONTAINER ID  IMAGE                                       COMMAND  CREATED         STATUS                      PORTS  NAMES
c2beba4c5776  docker.io/mirrorgooglecontainers/pause:3.1           27 minutes ago  Exited (137) 2 seconds ago         8628b8a8ba8a-infra

# podman pod kill --all --signal SIGINT
# podman ps -a
CONTAINER ID  IMAGE                                       COMMAND  CREATED         STATUS                         PORTS                 NAMES
c2beba4c5776  docker.io/mirrorgooglecontainers/pause:3.1           29 minutes ago  Exited (137) 2 minutes ago                           8628b8a8ba8a-infra
529baa5a5267  docker.io/mirrorgooglecontainers/pause:3.1           32 minutes ago  Exited (0) About a minute ago                        890fa658cde8-infra
dbe36a258da0  docker.io/mirrorgooglecontainers/pause:3.1           38 minutes ago  Exited (0) About a minute ago  0.0.0.0:123->123/tcp  d1b8e3335673-infra
退出码不一样

podman-pod-rm

# podman pod ps
POD ID         NAME             STATUS   CREATED          # OF CONTAINERS   INFRA ID
8628b8a8ba8a   latest-pod       Exited   30 minutes ago   1                 c2beba4c5776
890fa658cde8   label-file-pod   Exited   33 minutes ago   1                 529baa5a5267
d1b8e3335673   pod-test         Exited   39 minutes ago   1                 dbe36a258da0

# podman pod rm -f -l
# podman pod ps
POD ID         NAME             STATUS   CREATED          # OF CONTAINERS   INFRA ID
890fa658cde8   label-file-pod   Exited   33 minutes ago   1                 529baa5a5267
d1b8e3335673   pod-test         Exited   39 minutes ago   1                 dbe36a258da0

# podman pod rm --all
# podman pod ps | wc -l
0
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 215,794评论 6 498
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,050评论 3 391
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 161,587评论 0 351
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,861评论 1 290
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,901评论 6 388
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,898评论 1 295
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,832评论 3 416
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,617评论 0 271
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,077评论 1 308
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,349评论 2 331
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,483评论 1 345
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,199评论 5 341
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,824评论 3 325
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,442评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,632评论 1 268
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,474评论 2 368
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,393评论 2 352

推荐阅读更多精彩内容

  • 一、Docker 简介 Docker 两个主要部件:Docker: 开源的容器虚拟化平台Docker Hub: 用...
    R_X阅读 4,384评论 0 27
  • 转自:https://www.cnblogs.com/ivictor/archive/2015/09/08/479...
    Juggle阅读 385评论 0 0
  • 请示等死个人;指示传递的牛头不对马嘴。 不清楚合弄制的具体 但是我相信好的企业每个员工都有决定权,每个人为自己的决...
    Snow聘谁阅读 250评论 0 0
  • 我家男人昨晚上八点多和一美男子出去,说好了十二点准时回家。我早早躺下睡了,白天太热,晚上躺空调房确实舒服,一觉醒来...
    六月荷清香阅读 1,424评论 38 39
  • 敬畏—进入—体验—交给—持续 1,缺啥补啥,怕啥练啥; 2,一切为我所用,所用为团队家; 3,我想变,我要变,我...
    cac47ec5e164阅读 85评论 0 0