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