Podman : Systemd यूनिट फ़ाइल जनरेट करें2024/05/03 |
Systemd यूनिट फ़ाइल जेनरेट करना और कंटेनरों के लिए ऑटो-स्टार्टिंग सेट करना संभव है।
|
|
[1] | Quadlet का उपयोग करके कंटेनर सेवा कॉन्फ़िगर करें। |
[root@dlp ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/podman-pause 5.0.2-1713312000 93b49289d5db 17 minutes ago 742 kB srv.world/iproute latest dafe2df281ae 25 minutes ago 307 MB localhost/root_web latest 53d5fa92aef2 About an hour ago 340 MB srv.world/fedora-nginx latest cf5af4219b13 2 hours ago 340 MB srv.world/fedora-httpd latest 9d6d273370e2 2 hours ago 343 MB dlp.srv.world:5000/fedora my-registry 19f52f582331 3 hours ago 229 MB registry.fedoraproject.org/fedora latest 19f52f582331 3 hours ago 229 MB docker.io/library/mariadb latest 465bc4da7f09 2 months ago 411 MB # फ़ाइल का नाम ⇒ (कोई भी नाम).container [root@dlp ~]# vi /etc/containers/systemd/fedora-nginx.container [Unit] Description=Nginx container After=local-fs.target [Container] # कोई भी नाम ContainerName=fedora-nginx # उपयोग की जाने वाली कंटेनर छवि Image=srv.world/fedora-nginx # पत्तन PublishPort=80:80 [Service] Restart=always [Install] WantedBy=multi-user.target default.target systemctl daemon-reload [root@dlp ~]# systemctl start fedora-nginx.service
|
[2] | Quadlet का उपयोग करके पॉड सेवा कॉन्फ़िगर करें। |
[root@dlp ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/podman-pause 5.0.2-1713312000 93b49289d5db 18 minutes ago 742 kB srv.world/iproute latest dafe2df281ae 26 minutes ago 307 MB localhost/root_web latest 53d5fa92aef2 About an hour ago 340 MB srv.world/fedora-nginx latest cf5af4219b13 2 hours ago 340 MB srv.world/fedora-httpd latest 9d6d273370e2 2 hours ago 343 MB dlp.srv.world:5000/fedora my-registry 19f52f582331 3 hours ago 229 MB registry.fedoraproject.org/fedora latest 19f52f582331 3 hours ago 229 MB docker.io/library/mariadb latest 465bc4da7f09 2 months ago 411 MB # पॉड कॉन्फ़िगरेशन फ़ाइल बनाएं # प्रारूप Kubernetes के समान है [root@dlp ~]# vi /etc/containers/systemd/nginx-pod.yml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-pod labels: name: nginx-pod spec: replicas: 1 selector: matchLabels: app: nginx-pod template: metadata: labels: app: nginx-pod spec: containers: - name: nginx-pod image: fedora-nginx ports: - name: web containerPort: 80 [Unit] Description=Web service pod After=local-fs.target [Kube] Yaml=/etc/containers/systemd/nginx-pod.yml PublishPort=80:80 [Service] Restart=always [Install] WantedBy=multi-user.target default.target systemctl daemon-reload [root@dlp ~]# systemctl start nginx-pod.service
|
Sponsored Link |
|