Pastebin
Paste #28707: No description
< previous paste - next paste>
Pasted by Anonymous Coward
########### Creating a systemd service as root
(azureuser@podman1) (2025-04-12 07:57:20) [0]
~$ podman container ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
(azureuser@podman1) (2025-04-12 07:57:22) [0]
~$ sudo su -
(root@podman1) (2025-04-12 07:57:31) [0]
~# podman container run -d --name www2 -e TZ='Europe/Copenhagen' -p 8082:80 -v /home/azureuser/podman/www:/var/www/html docker.io/ubuntu/apache2:latest
Trying to pull docker.io/ubuntu/apache2:latest...
Getting image source signatures
Copying blob 4dc44e212a77 done
Copying blob 742adbd14f98 done
Copying blob 7b7f87d905cc done
Copying config 547dd497e2 done
Writing manifest to image destination
Storing signatures
48b53132bb8d1b515ea5fcdbd58c26fc545b2eee116ffec436c32e974103f4ef
(root@podman1) (2025-04-12 07:58:39) [0]
~# ss -tln
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 4096 0.0.0.0:5355 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 4096 0.0.0.0:8082 0.0.0.0:*
LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:*
LISTEN 0 4096 127.0.0.54:53 0.0.0.0:*
LISTEN 0 100 127.0.0.1:25 0.0.0.0:*
LISTEN 0 4096 [::]:5355 [::]:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 100 [::1]:25 [::]:*
(root@podman1) (2025-04-12 07:59:01) [0]
~# podman container stop www2
WARN[0010] StopSignal SIGWINCH failed to stop container www2 in 10 seconds, resorting to SIGKILL
www2
(root@podman1) (2025-04-12 07:59:42) [0]
~# podman generate systemd www2
# container-48b53132bb8d1b515ea5fcdbd58c26fc545b2eee116ffec436c32e974103f4ef.service
# autogenerated by Podman 4.3.1
# Sat Apr 12 08:00:14 UTC 2025
[Unit]
Description=Podman container-48b53132bb8d1b515ea5fcdbd58c26fc545b2eee116ffec436c32e974103f4ef.service
Documentation=man:podman-generate-systemd(1)
Wants=network-online.target
After=network-online.target
RequiresMountsFor=/run/containers/storage
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStart=/usr/bin/podman start 48b53132bb8d1b515ea5fcdbd58c26fc545b2eee116ffec436c32e974103f4ef
ExecStop=/usr/bin/podman stop \
-t 10 48b53132bb8d1b515ea5fcdbd58c26fc545b2eee116ffec436c32e974103f4ef
ExecStopPost=/usr/bin/podman stop \
-t 10 48b53132bb8d1b515ea5fcdbd58c26fc545b2eee116ffec436c32e974103f4ef
PIDFile=/run/containers/storage/overlay-containers/48b53132bb8d1b515ea5fcdbd58c26fc545b2eee116ffec436c32e974103f4ef/userdata/conmon.pid
Type=forking
[Install]
WantedBy=default.target
(root@podman1) (2025-04-12 08:00:14) [0]
~# podman generate systemd www2 > /etc/systemd/system
system/ system.conf
(root@podman1) (2025-04-12 08:00:14) [0]
~# podman generate systemd www2 > /etc/systemd/system/www2.service
(root@podman1) (2025-04-12 08:00:40) [0]
~# systemctl daemon-reload
(root@podman1) (2025-04-12 08:00:51) [0]
~# ss -tln
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 4096 0.0.0.0:5355 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:*
LISTEN 0 4096 127.0.0.54:53 0.0.0.0:*
LISTEN 0 100 127.0.0.1:25 0.0.0.0:*
LISTEN 0 4096 [::]:5355 [::]:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 100 [::1]:25 [::]:*
(root@podman1) (2025-04-12 08:01:06) [0]
~# systemctl enable --now www2
Created symlink /etc/systemd/system/default.target.wants/www2.service → /etc/systemd/system/www2.service.
(root@podman1) (2025-04-12 08:01:22) [0]
~# ss -tln
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 4096 0.0.0.0:5355 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 4096 0.0.0.0:8082 0.0.0.0:*
LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:*
LISTEN 0 4096 127.0.0.54:53 0.0.0.0:*
LISTEN 0 100 127.0.0.1:25 0.0.0.0:*
LISTEN 0 4096 [::]:5355 [::]:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 100 [::1]:25 [::]:*
(root@podman1) (2025-04-12 08:01:29) [0]
~# systemctl status www2
● www2.service - Podman container-48b53132bb8d1b515ea5fcdbd58c26fc545b2eee116ffec436c32e974103f4ef.service
Loaded: loaded (/etc/systemd/system/www2.service; enabled; preset: enabled)
Active: active (running) since Sat 2025-04-12 08:01:22 UTC; 15s ago
Docs: man:podman-generate-systemd(1)
Process: 24658 ExecStart=/usr/bin/podman start 48b53132bb8d1b515ea5fcdbd58c26fc545b2eee116ffec436c32e974103f4ef (code=exited, status=0/SUCCESS)
Main PID: 24718 (conmon)
Tasks: 1 (limit: 9455)
Memory: 864.0K
CPU: 108ms
CGroup: /system.slice/www2.service
└─24718 /usr/bin/conmon --api-version 1 -c 48b53132bb8d1b515ea5fcdbd58c26fc545b2eee116ffec436c32e974103f4ef -u 48b53132bb8d1b515ea5fcdbd58>
Apr 12 08:01:26 podman1 www2[24718]: 89.150.154.55 - - [12/Apr/2025:10:01:26 +0200] "GET /images/Globo-Logo-white.svg HTTP/1.1" 304 -
Apr 12 08:01:26 podman1 www2[24718]: 89.150.154.55 - - [12/Apr/2025:10:01:26 +0200] "GET /images/Bitmap.png HTTP/1.1" 304 -
Apr 12 08:01:26 podman1 www2[24718]: 89.150.154.55 - - [12/Apr/2025:10:01:26 +0200] "GET /images/hero%20image.png HTTP/1.1" 304 -
Apr 12 08:01:26 podman1 www2[24718]: 89.150.154.55 - - [12/Apr/2025:10:01:26 +0200] "GET /images/Bitmap(1).png HTTP/1.1" 304 -
Apr 12 08:01:26 podman1 www2[24718]: 89.150.154.55 - - [12/Apr/2025:10:01:26 +0200] "GET /js/jquery.min.js HTTP/1.1" 200 33766
Apr 12 08:01:26 podman1 www2[24718]: 89.150.154.55 - - [12/Apr/2025:10:01:26 +0200] "GET /js/bootstrap.min.js HTTP/1.1" 200 9833
Apr 12 08:01:26 podman1 www2[24718]: 89.150.154.55 - - [12/Apr/2025:10:01:26 +0200] "GET /images/shutterstock_211091626.png HTTP/1.1" 304 -
Apr 12 08:01:26 podman1 www2[24718]: 89.150.154.55 - - [12/Apr/2025:10:01:26 +0200] "GET /images/Globo-Logo-white-footer.svg HTTP/1.1" 304 -
Apr 12 08:01:26 podman1 www2[24718]: 89.150.154.55 - - [12/Apr/2025:10:01:26 +0200] "GET /images/G.png HTTP/1.1" 304 -
Apr 12 08:01:26 podman1 www2[24718]: 89.150.154.55 - - [12/Apr/2025:10:01:26 +0200] "GET /images/pluralsight-white.png HTTP/1.1" 304 -
(root@podman1) (2025-04-12 08:01:42) [0]
~#
########### Creating a systemd service as non-root
New Paste
Go to most recent paste.