Container in REDHAT
Container in REDHAT
a) Using the URL to build the container image with name monitor.
http://classroom.example.com/Containerfile
c) Do not modify the container file
######Note try to SSH with the User Don't Switch it from Root ########## USer
Password = The Same Password for the Root
$ ssh [email protected]
$ wget http://classroom.example.com/Containerfile
$ ls
$ Container-file
$ podman login ( You will find the Link in exam put it here then Enter)
$ username:- ( You will find in The Document not in the exam paper )
$ Password:- ( You will find in The Document not in the exam paper )
Login Successfully
$ podman build -t monitor -f Container-file
#########For Check#####################
$ podman images
14. Configure the container as a system start-up service and mount volumes
persistently
a) Create the container name as ascii2pdf as student user
b) Run the container by using image monitor which one was already done in previous
c) Create the container as a system start-up service, While reboot it will
automatically start the
service without any human intervention.
d) The system service should be container-ascii2pdf.
e) The local directory /opt/files should be persistently mount on container’s
/opt/incoming
directory.
f) The local directory /opt/processed should be persistently mount on
container’s /opt/outgoing
directory.
Note: In working of service starts, any file create/store under the /opt/files
automatically
creates into pdf on /opt/outgoing directory.
######### SSH With Root to create the Directories + chown -R + chmod 777
#############
$ ssh [email protected]
$ mkdir /opt/files
$ mkdir /opt/processed
$ chown -R walhalla:walhalla /opt/files
$ chown -R walhalla:walhalla /opt/processed
$ chmod 777 /opt/files
$ chmod 777 /opt/processed
######### For Check ########
$ ls -ld /opt/files
$ ls -ld /opt/processed
$ exit ###### end the SSH from Root and try new SSH with user DOnt Switch to User
from the same Shell ##########
$ ssh [email protected]
$ loginctl enable-linger walhalla
$ loginctl show-user walhalla | grep "Linger" ##### Should be yes
$ podman run -d --name ascii2pdf -v /opt/processed/:/opt/outgoing/:Z -v
/opt/files/:/opt/outgoing/:Z monitor
$ mkdir /home/walhalla/.config/systemd/user -p
$ cd /home/walhalla/.config/systemd/user
$ podman generate systemd --files --new --name ascii2pdf
$ ls
$ container-ascii2pdf.service
$ systemctl --user daemon-reload ### no error = You in the right way ###
$ systemctl –user enable --now container-ascii2pdf.service ### autocomplate
###
$ podman container rm logserver -f ##### the container will remove and the
service will create new one in notime #####