podman:pod
Podman POD
POD létrehozása podman segítségével
Ellenőrzések
# podman ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES # podman image ls REPOSITORY TAG IMAGE ID CREATED SIZE # podman network ls NETWORK ID NAME DRIVER 2f259bab93aa podman bridge # podman secret ls ID NAME DRIVER CREATED UPDATED # podman volume ls DRIVER VOLUME NAME
Pod létrehozása
# podman pod create -p 80:80 --name webpod 0441cfc47b45869dff947ea4840a0430b560540567dc25779aad61d705c2f37a
Ellenőrzés
# podman pod ls
POD ID NAME STATUS CREATED INFRA ID # OF CONTAINERS
0441cfc47b45 webpod Created 25 seconds ago 240a49036581 1
# podman pod inspect webpod
[
{
"Id": "0441cfc47b45869dff947ea4840a0430b560540567dc25779aad61d705c2f37a",
"Name": "webpod",
"Created": "2026-03-30T06:24:26.079826698+02:00",
"CreateCommand": [
"podman",
"pod",
"create",
"-p",
"80:80",
"--name",
"webpod"
],
"ExitPolicy": "continue",
"State": "Running",
"Hostname": "",
"CreateCgroup": true,
"CgroupParent": "machine.slice",
"CgroupPath": "machine.slice/machine-libpod_pod_0441cfc47b45869dff947ea4840a0430b560540567dc25779aad61d705c2f37a.slice",
"CreateInfra": true,
"InfraContainerID": "240a49036581acb996b2b9f90d01dce0845c7b72adaae83b6c0b99af07f09a1e",
"InfraConfig": {
"PortBindings": {
"80/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "80"
}
]
},
"HostNetwork": false,
"StaticIP": "",
"StaticMAC": "",
"NoManageResolvConf": false,
"DNSServer": null,
"DNSSearch": null,
"DNSOption": null,
"NoManageHostname": false,
"NoManageHosts": false,
"HostAdd": null,
"HostsFile": "",
"Networks": [
"podman"
],
"NetworkOptions": null,
"pid_ns": "private",
"userns": "host",
"uts_ns": "private"
},
"SharedNamespaces": [
"uts",
"ipc",
"net"
],
"NumContainers": 1,
"Containers": [
{
"Id": "240a49036581acb996b2b9f90d01dce0845c7b72adaae83b6c0b99af07f09a1e",
"Name": "0441cfc47b45-infra",
"State": "running"
}
],
"LockNumber": 0
}
]
# podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
240a49036581 About a minute ago Created 0.0.0.0:80->80/tcp 0441cfc47b45-infra
Régebbi podman változatokban az image-ek listázásakor látszott a podman-pause infrastruktúra image.
# podman image ls REPOSITORY TAG IMAGE ID CREATED SIZE localhost/podman-pause 5.4.0-1757462400 918a1d4c216b About a minute ago 706 kB
Konténerek hozzáadása
# podman run -d --name nginx --pod webpod nginx
Resolved "nginx" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull docker.io/library/nginx:latest...
Getting image source signatures
Copying blob ec781dee3f47 done |
Copying blob 3189680c601f done |
Copying blob bb3d0aa29654 done |
Copying blob cde7a05ae428 done |
Copying blob 510ddf6557d6 done |
Copying blob 587e3d84dbb5 done |
Copying blob 5e815e07e569 done |
Copying config 0cf1d6af5c done |
Writing manifest to image destination
7ef087f7bdba3a57f7c0f728b5d20ce1a11831af4c6e6e8b07dede19ea7eaf33
# podman run -it --rm --pod webpod busybox wget -qO- http://127.0.0.1
Resolved "busybox" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull docker.io/library/busybox:latest...
Getting image source signatures
Copying blob 481282afbc43 done |
Copying config 925ff61909 done |
Writing manifest to image destination
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, nginx is successfully installed and working.
Further configuration is required for the web server, reverse proxy,
API gateway, load balancer, content cache, or other features.</p>
<p>For online documentation and support please refer to
<a href="https://nginx.org/">nginx.org</a>.<br/>
To engage with the community please visit
<a href="https://community.nginx.org/">community.nginx.org</a>.<br/>
For enterprise grade support, professional services, additional
security features and capabilities please refer to
<a href="https://f5.com/nginx">f5.com/nginx</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
Ellenőrzés
# podman pod inspect --format '{{range .Containers}}{{.Name}}{{"\n"}}{{end}}' webpod
0441cfc47b45-infra
nginx
# podman inspect -f '{{.State.Pid}}' 0441cfc47b45-infra
3795
# ls -l /proc/3795/ns/
total 0
lrwxrwxrwx. 1 root root 0 Mar 30 06:48 cgroup -> 'cgroup:[4026532575]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:27 ipc -> 'ipc:[4026532573]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:48 mnt -> 'mnt:[4026532571]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:27 net -> 'net:[4026532470]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:48 pid -> 'pid:[4026532574]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:48 pid_for_children -> 'pid:[4026532574]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:48 time -> 'time:[4026531834]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:48 time_for_children -> 'time:[4026531834]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:48 user -> 'user:[4026531837]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:27 uts -> 'uts:[4026532572]'
# lsns -p 3795
NS TYPE NPROCS PID USER COMMAND
4026531834 time 153 1 root /usr/lib/systemd/systemd --switched-root --s
4026531837 user 153 1 root /usr/lib/systemd/systemd --switched-root --s
4026532470 net 4 3795 root /catatonit -P
4026532571 mnt 1 3795 root /catatonit -P
4026532572 uts 4 3795 root /catatonit -P
4026532573 ipc 4 3795 root /catatonit -P
4026532574 pid 1 3795 root /catatonit -P
4026532575 cgroup 1 3795 root /catatonit -P
# podman inspect -f '{{.State.Pid}}' nginx
6261
# ls -l /proc/6261/ns/
total 0
lrwxrwxrwx. 1 root root 0 Mar 30 06:49 cgroup -> 'cgroup:[4026532578]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:49 ipc -> 'ipc:[4026532573]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:49 mnt -> 'mnt:[4026532576]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:49 net -> 'net:[4026532470]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:49 pid -> 'pid:[4026532577]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:49 pid_for_children -> 'pid:[4026532577]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:49 time -> 'time:[4026531834]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:49 time_for_children -> 'time:[4026531834]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:49 user -> 'user:[4026531837]'
lrwxrwxrwx. 1 root root 0 Mar 30 06:49 uts -> 'uts:[4026532572]'
# lsns -p 6261
NS TYPE NPROCS PID USER COMMAND
4026531834 time 154 1 root /usr/lib/systemd/systemd --switched-root --s
4026531837 user 154 1 root /usr/lib/systemd/systemd --switched-root --s
4026532470 net 4 3795 root /catatonit -P
4026532572 uts 4 3795 root /catatonit -P
4026532573 ipc 4 3795 root /catatonit -P
4026532576 mnt 3 6261 root nginx: master process nginx -g daemon off;
4026532577 pid 3 6261 root nginx: master process nginx -g daemon off;
4026532578 cgroup 3 6261 root nginx: master process nginx -g daemon off;
A catatonit egy a podman konténerben használt egy nagyon kicsi init / PID 1 helper folyamat.
Pod törlése
# podman pod stop webpod # podman pod rm webpod
Pod létrehozáda YAML fájl segítségével
- nginx-pod.yaml
apiVersion: v1 kind: Pod metadata: name: webpod spec: containers: - name: nginx image: docker.io/library/nginx:latest ports: - containerPort: 80 - name: busybox image: docker.io/library/busybox:latest command: ["sleep", "3600"]
Futtatás
podman play kube nginx-pod.yaml
podman/pod.txt · legutóbbi módosítás: – Szerkesztő: riba.zoltan
