1) Build monitor container image with the given Containerfile
http://materials.example.com/Containerfile
Create a container named monitor
ssh root@servera
[root@servera ~]# yum install -y container-tools
[root@servera ~]# ctrl +d --> To exit
Note: You must do ssh to the user(username you can find username details in 2nd
Question),
don't switch to user using su - neil
In Exam read clearly Additional/Important Info to understand about username to execute
container using neil and password is Flectrag
ssh neil@servera
[neil@servera ~]$
Log in to the container registry using the podman login command.
(In exam, Read Additional/Important Info to understand registry server URL, username
and password details)
[neil@servera ~]$ podman login registry.lab.example.com
Username: admin
Password: redhat321
[neil@servera ~]$ wget http://materials.example.com/Containerfile
[neil@servera ~]$ ls -l
[neil@servera ~]$ podman build -t monitor .
[neil@servera ~]$ podman images
[neil@servera ~]$ podman run -d --name monitor monitor
Note: loginctl enable-linger <username> to run container after changing user
[neil@servera ~]$ loginctl enable-linger neil
[neil@servera ~]$ podman ps
2) Configure your host incoming /opt/inbound and outgoing /opt/outbound to
store all journal across reboot.
Configure persistent volume /opt/inbound host folder to the /opt/incoming
container folder and /opt/outbound host folder to the /opt/outgoing
container folder.
When the container starts create container-logserver.service to run the
container persistently with “neil” user credentials.
Check for host dirs
[neil@servera ~]$ ls -ld /opt/inbound /opt/outbound
Note: If given dirs doesn't exists, create it otherwise check ownership of the folder
[neil@servera ~]$ sudo -i or su -
[root@servera ~]# mkdir -p /opt/inbound /opt/outbound
[root@servera ~]# chown neil:neil /opt/inbound
[root@servera ~]# chown neil:neil /opt/outbound
[root@servera ~]# ctrl+d --> To exit
ssh neil@servera
[neil@servera ~]$
podman run -d --name logserver -v /opt/inbound:/opt/incoming:z -v
/opt/outbound:/opt/outgoing:z monitor
Note: Container Name logserver, why because When the container starts create
container-logserver.service
[neil@servera ~]$ podman ps
[neil@servera ~]$ mkdir -p .config/systemd/user
[neil@servera ~]$ cd .config/systemd/user
[neil@servera user]$
[neil@servera user]$ podman generate systemd --help | more
[neil@servera user]$ podman generate systemd --name logserver --files --new
[neil@servera user]$ system --user daemon-reload
[containers@servera user]$ systemctl --user enable container-logserver.service
[containers@servera user]$ su -
[root@servera ~]# reboot