0% found this document useful (0 votes)
47 views2 pages

Container Service Setup Guide

Container

Uploaded by

MohamedHama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views2 pages

Container Service Setup Guide

Container

Uploaded by

MohamedHama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Create a Container based Service:

 Create a container named logserver which is using rsyslog service. The required image is
already available in the current registry.

 Create the systemd service file for the user xandu at the appropriate home directory path.

 Enable the systemd service for the logserver container and only the xandu user can login and
start the container service.

Step-1:
As the root user in the server install the following package

#yum module install container-tools

Enable linger permission for the user

#loginctl enable-linger xandu

Step-2:

Login as the xandu user using the following

# su – xandu

Login in to the registry using the credentials (it will be provided in the initial setup page)

#podman login registry.lab.example.com


#username: xandu
#password: xxxxx
Step-3:

Run the container using the following command

#podman run - -name logserver -d registry.lab.example.com/syslog


Step-4:
If this directory is present in the exam skip this step
create the directory at the specified location as
#mkdir -p .config/systemd/user/
#cd mkdir -p .config/systemd/user/
Step-5:

Generate the systemd service files for the user in the location mkdir -p .config/systemd/user/

#podman generate systemd - -name logserver - -files - -new

container-logserver.service file will be generate


Step-6:
Stop and remove the running container

#podman stop logserver


#podman rm logserver

Step-7:

Reload the systemctl damon as

#systemctl --user daemon-reload

Step-8:

Start the service and enable the service using the following command

#systemctl - -user start container-logserver.service


#systemctl - -user enable container-logserver.service
Step-9:

Verify that the container is started and enabled then running.

#podman ps
#systemctl - -user status container-logserver.service

2. Create a container persistent storage:

Create a Webserver container with persistent storage, the created container should store the
/var/www to the local user home directory at the locaton /home/xandu/container-storage. Use the

Step-1:

Verify the presence of the local directory and create the container

Podman run - -name webserver –d –v /home/xandu/container-storage:/var/www:Z


registry.lab.example.com/rhel8/httpd-24:1-98

Step-2:

Verify the container is running using the command

#podman ps

You might also like