nerdexam
Red_Hat

EX200 · Question #14

14. Configure Container as a Service As the user "wallah," configure a systemd service for the container: - Container name: ascii2pdf - Use the image named pdf created earlier. - Service name…

A podman run command is used to create and configure a container with a specified name and volume mounts, serving as the basis for a systemd service.

Submitted by fatima_kr· Apr 18, 2026Manage Containers

Question

  1. Configure Container as a Service As the user "wallah," configure a systemd service for the container: - Container name: ascii2pdf - Use the image named pdf created earlier. - Service name: container-ascii2pdf - Automatically start the service on system reboot without manual intervention. - Configure the service to automatically mount /opt/file to /dir1 and /opt/progress to /dir2 in the container upon startup. Correct Answer: See the below explanation Explanation Explanation/Reference: Solution: # Note: Perform the following operations by SSHing into localhost as the user "wallah" [root@node1 ~]# ssh wallah@localhost # Prepare the relevant mapping directories [wallah@node1 ~]$ sudo mkdir /opt/{file,progress} [wallah@node1 ~]$ podman run -d --name ascii2pdf -v /opt/file:/dir1:Z -v /opt/progress:/dir2:Z pdf [wallah@node1 ~]$ podman ps -a # Create systemd service file [wallah@node1 ~]$ mkdir -p ~/.config/systemd/user [wallah@node1 ~]$ cd ~/.config/systemd/user/ [wallah@node1 ~]$ podman generate systemd -n ascii2pdf -f --new [wallah@node1 user]$ ll total 4 -rw-r--r--. 1 wallah wallah 770 Dec 13 01:07 container-ascii2pdf.service # Stop and remove the existing ascii2pdf container [wallah@node1 ~]$ podman stop ascii2pdf [wallah@node1 ~]$ podman rm ascii2pdf [wallah@node1 ~]$ podman ps -a # Enable and start the container-ascii2pdf service [wallah@node1 ~]$ systemctl --user daemon-reload [wallah@node1 ~]$ systemctl --user enable --now container-ascii2pdf # Check container status [wallah@node1 ~]$ systemctl --user status container-ascii2pdf [wallah@node1 ~]$ podman ps # Ensure that the services for the wallah user start automatically at system boot [root@node1 ~]# loginctl enable-linger [root@node1 ~]# loginctl show-user wallah # Check to ensure the container starts on boot (mandatory operation) [root@node1 ~]# reboot [root@node1 ~]# ssh wallah@node1 [wallah@node1 ~]# podman ps

Explanation

A podman run command is used to create and configure a container with a specified name and volume mounts, serving as the basis for a systemd service.

Concept tested. Running Podman containers with volume mounts

Reference. https://docs.podman.io/en/latest/markdown/podman-run.1.html

Topics

#podman#systemd user service#container autostart#volume mounting

Community Discussion

No community discussion yet for this question.

Full EX200 Practice