chlebik / rhcsa-practice-questions

RHCSA practice questions for version 7/8
549 stars 231 forks source link

Worth to add questions about podman #8

Closed AnnaBogdanovich91 closed 3 years ago

AnnaBogdanovich91 commented 3 years ago

Manage containers Find and retrieve container images from a remote registry Inspect container images Perform container management using commands such as podman and skopeo Perform basic container management such as running, starting, stopping, and listing running containers Run a service inside a container Configure a container to start automatically as a systemd service -- very important Attach persistent storage to a container there is

https://www.redhat.com/en/services/training/ex200-red-hat-certified-system-administrator-rhcsa-exam?section=Objectives

A sample question might be (not taken from any RHCSA exam)

Login to the registry. Download image for a webserver. Run web server in a container as a user-service on port 8080, sharing files from /home/user/webfiles

Sample answer: root$ podman login user$ podman create . f.e. podman create docker.io/library/httpd as I don't have any local registry present user$ podman run -d -v /home/user/webfiles:/usr/local/apache2/htdocs -p 8080:80 --name user_httpd docker.io/library/httpd user$ sudo podman generate systemd user_httpd -o /etc/systemd/user/user_httpd.service (or just copy output if user is not sudoer) user$ systemctl --user enable --now user_httpd.service (you need to be logged in as a user, not just su to it)

Add SELinux permissions to the catalog root$ semanage fcontext -at container_file_t "/home/admin/user(/.*)?" root$ restorecon -vR /home/admin/webfiles

Add port to the firewall root$ firewall-cmd --add-port=8080/tcp --permanent root$ firewall-cmd --reload

chlebik commented 3 years ago

I encourage to create a PR - I will accept it. The container-related questions weren't there when I was studying for the exam.