Podman : पॉड्स बनाएं2024/11/06 |
Kubernetes जैसे पॉड्स बनाएं।
|
|
[1] | एक पॉड बनाएं और उसमें एक कंटेनर जोड़ें। |
# एक खाली पॉड बनाएं # -p [bind port] -n [pod name] [root@dlp ~]# podman pod create -p 8081:80 -n test-pod 8edc163d3934fac3e8017d50cce5d23e8c7fb2b4ccd1ea3eb39abecb28dbe68f # फली दिखाओ [root@dlp ~]# podman pod ls POD ID NAME STATUS CREATED INFRA ID # OF CONTAINERS 8edc163d3934 test-pod Created 15 seconds ago 74c40763447c 1 # पॉड का विवरण दिखाएं [root@dlp ~]# podman pod inspect test-pod [ { "Id": "8edc163d3934fac3e8017d50cce5d23e8c7fb2b4ccd1ea3eb39abecb28dbe68f", "Name": "test-pod", "Created": "2024-11-06T10:08:22.952032622+09:00", "CreateCommand": [ "podman", "pod", "create", "-p", "8081:80", "-n", "test-pod" ], "ExitPolicy": "continue", "State": "Created", "Hostname": "", "CreateCgroup": true, "CgroupParent": "machine.slice", "CgroupPath": "machine.slice/machine-libpod_pod_8edc163d3934fac3e8017d50cce5d23e8c7fb2b4ccd1ea3eb39abecb28dbe68f.slice", "CreateInfra": true, "InfraContainerID": "74c40763447c56fc99baf0b1f1573e70d7934b5146ce202f57de4ebc64a83aa0", "InfraConfig": { "PortBindings": { "80/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "8081" } ] }, "HostNetwork": false, "StaticIP": "", "StaticMAC": "", "NoManageResolvConf": false, "DNSServer": null, "DNSSearch": null, "DNSOption": null, "NoManageHosts": false, "HostAdd": null, "Networks": [ "podman" ], "NetworkOptions": null, "pid_ns": "private", "userns": "host", "uts_ns": "private" }, "SharedNamespaces": [ "ipc", "net", "uts" ], "NumContainers": 1, "Containers": [ { "Id": "74c40763447c56fc99baf0b1f1573e70d7934b5146ce202f57de4ebc64a83aa0", "Name": "8edc163d3934-infra", "State": "created" } ], "LockNumber": 9 } ][root@dlp ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/podman-pause 5.2.5-1729209600 64b1ac1938a3 About a minute ago 758 kB srv.world/iproute latest 84acd2cc8c75 7 minutes ago 250 MB docker.io/library/root-web latest b38a153fb7b0 25 minutes ago 316 MB srv.world/fedora-nginx latest cb2e14e1465e 58 minutes ago 316 MB srv.world/fedora-httpd latest 4dfbd95b4ef6 About an hour ago 319 MB registry.fedoraproject.org/fedora latest 99519fcf3c1b 18 hours ago 163 MB docker.io/library/mariadb latest 4b8711c6c639 2 months ago 413 MB # कंटेनर चलाएं और इसे पॉड में जोड़ें [root@dlp ~]# podman run -dt --pod test-pod srv.world/fedora-nginx 224f2fa06a63a3b42f458deb0f96ed493e5303aee1a834f52711b789d904798c[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 74c40763447c localhost/podman-pause:5.2.5-1729209600 2 minutes ago Up 22 seconds 0.0.0.0:8081->80/tcp 8edc163d3934-infra 224f2fa06a63 srv.world/fedora-nginx:latest /usr/sbin/nginx -... 21 seconds ago Up 22 seconds 0.0.0.0:8081->80/tcp practical_payne # पहुंच सत्यापित करें [root@dlp ~]# curl localhost:8081 Podman Test on Nginx # फली बंद करो [root@dlp ~]# podman pod stop test-pod test-pod # पॉड हटाएं (सभी कंटेनर हटा दिए गए) [root@dlp ~]# podman pod rm test-pod --force 8edc163d3934fac3e8017d50cce5d23e8c7fb2b4ccd1ea3eb39abecb28dbe68f |
[2] | एक कमांड से पॉड बनाना और कंटेनर जोड़ना संभव है। |
[root@dlp ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/podman-pause 5.2.5-1729209600 64b1ac1938a3 3 minutes ago 758 kB srv.world/iproute latest 84acd2cc8c75 10 minutes ago 250 MB docker.io/library/root-web latest b38a153fb7b0 27 minutes ago 316 MB srv.world/fedora-nginx latest cb2e14e1465e About an hour ago 316 MB srv.world/fedora-httpd latest 4dfbd95b4ef6 About an hour ago 319 MB registry.fedoraproject.org/fedora latest 99519fcf3c1b 18 hours ago 163 MB docker.io/library/mariadb latest 4b8711c6c639 2 months ago 413 MB # एक [test-pod2] पॉड बनाएं और [srv.world/fedora-nginx] कंटेनर जोड़ें [root@dlp ~]# podman run -dt --pod new:test-pod2 -p 80:80 -p 3306:3306 srv.world/fedora-nginx 3c2cdac3fe7ed942d866f78081a95c5a63f38f169a4df6e23444265473edefd3[root@dlp ~]# podman pod ls POD ID NAME STATUS CREATED INFRA ID # OF CONTAINERS 81eec718b5c0 test-pod2 Running 17 seconds ago 999ceea9c7b3 2[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 999ceea9c7b3 localhost/podman-pause:5.2.5-1729209600 38 seconds ago Up 38 seconds 0.0.0.0:80->80/tcp, 0.0.0.0:3306->3306/tcp 81eec718b5c0-infra 3c2cdac3fe7e srv.world/fedora-nginx:latest /usr/sbin/nginx -... 38 seconds ago Up 38 seconds 0.0.0.0:80->80/tcp, 0.0.0.0:3306->3306/tcp gallant_poincare # [mariadb] कंटेनर चलाएँ और इसे [test-pod2] में जोड़ें [root@dlp ~]# podman run -dt --pod test-pod2 -e MYSQL_ROOT_PASSWORD=Password docker.io/library/mariadb 529b7d2c1e46be99bd685a1c2659df99f5db84e6f835874a0efd1b0fe92a48ba[root@dlp ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 999ceea9c7b3 localhost/podman-pause:5.2.5-1729209600 About a minute ago Up About a minute 0.0.0.0:80->80/tcp, 0.0.0.0:3306->3306/tcp 81eec718b5c0-infra 3c2cdac3fe7e srv.world/fedora-nginx:latest /usr/sbin/nginx -... About a minute ago Up About a minute 0.0.0.0:80->80/tcp, 0.0.0.0:3306->3306/tcp gallant_poincare 529b7d2c1e46 docker.io/library/mariadb:latest mariadbd 14 seconds ago Up 15 seconds 0.0.0.0:80->80/tcp, 0.0.0.0:3306->3306/tcp compassionate_hertz
[root@dlp ~]#
[root@dlp ~]# curl dlp.srv.world Dockerfile Test on Nginx mysql -u root -p -h dlp.srv.world -e "show variables like 'hostname';" Enter password: +---------------+-----------+ | Variable_name | Value | +---------------+-----------+ | hostname | test-pod2 | +---------------+-----------+ |
Sponsored Link |
|