0% found this document useful (0 votes)
2 views3 pages

Build and Run Podman Container Service

The document outlines the steps to build and run a container image named 'monitor' using Podman, including user setup and SSH configuration. It details the creation of directories for file processing and the generation of a systemd service to run the container as a service. Additionally, it includes commands for managing the container and ensuring it starts on boot.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Build and Run Podman Container Service

The document outlines the steps to build and run a container image named 'monitor' using Podman, including user setup and SSH configuration. It details the creation of directories for file processing and the generation of a systemd service to run the container as a service. Additionally, it includes commands for managing the container and ensuring it starts on boot.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

[Link]

com/Containerfile

dnf -y install container-tools

useradd apple
passwd 1

ssh-keygen

ssh-copy-id -f -i /root/.ssh/id_rsa.pub apple@localhost

***build the image named monitor***


*** download file from [Link]
*** username – apple password – 1 ***

# ssh apple@localhost (ssh apple@node1)

$ podman login -u admin -p redhat321 [Link] --tls-verify=false

$ wget [Link]

$ podman build -t monitor .

$ podman images

$ exit

***Mount the directories “files” & “processed”:***


***files (in your VM): incoming (container)***
***processed (in your VM): outgoing (container)***

# mkdir /opt/files /opt/processed


# chmod 777 /opt/files /opt/processed
# chown apple:apple /opt/files /opt/processed

# ssh apple@localhost

$ podman run -d --name ascii2pdf -v /opt/files:/opt/incoming:Z -v


/opt/processed:/opt/outgoing:Z localhost/monitor:latest

$ podman ps
***Creating a container as a service***

$ mkdir -p ~/.config/systemd/user

$ cd ~/.config/systemd/user

$ podman generate systemd --name ascii2pdf --files --new

$ podman stop ascii2pdf

$ podman rm ascii2pdf

$ systemctl --user daemon-reload

$ systemctl --user start [Link]

$ systemctl --user enable [Link]

$ systemctl --user status [Link]

$ loginctl enable-linger apple

$ loginctl show-user apple

$ exit

# reboot

# ssh apple@localhost
Password:

$ pdman ps

You might also like