Podman : Systemd यूनिट फ़ाइल जनरेट करें2023/11/16 |
Systemd यूनिट फ़ाइल जेनरेट करना और कंटेनरों के लिए ऑटो-स्टार्टिंग सेट करना संभव है।
|
|
[1] | Quadlet का उपयोग करके कंटेनर सेवा कॉन्फ़िगर करें। |
[root@dlp ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/podman-pause 4.7.2-1698762721 cb1af0765d22 12 minutes ago 1.14 MB srv.world/iproute latest b2ff20987c53 20 minutes ago 417 MB localhost/root_web latest e1fc63ab5511 47 minutes ago 447 MB srv.world/fedora-nginx latest 6a43f18a8fc3 About an hour ago 447 MB srv.world/fedora-httpd latest 43a608e50bc8 2 hours ago 459 MB registry.fedoraproject.org/fedora latest ec546109f822 8 days ago 183 MB dlp.srv.world:5000/fedora my-registry ec546109f822 8 days ago 183 MB docker.io/library/mariadb latest f35870862d64 4 weeks ago 410 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 4.7.2-1698762721 cb1af0765d22 12 minutes ago 1.14 MB srv.world/iproute latest b2ff20987c53 20 minutes ago 417 MB localhost/root_web latest e1fc63ab5511 47 minutes ago 447 MB srv.world/fedora-nginx latest 6a43f18a8fc3 About an hour ago 447 MB srv.world/fedora-httpd latest 43a608e50bc8 2 hours ago 459 MB registry.fedoraproject.org/fedora latest ec546109f822 8 days ago 183 MB dlp.srv.world:5000/fedora my-registry ec546109f822 8 days ago 183 MB docker.io/library/mariadb latest f35870862d64 4 weeks ago 410 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 |
|