Containers: podman, images, containers, auto-start with systemd
Sign in to read this lesson
A container runs an application together with all its dependencies in one package — it no longer matters which PHP version is installed on the server. RHEL's container tool is podman — the same commands as Docker, but daemonless and rootless. In this lesson we learn to pull images, run containers, keep data in a volume (with SELinux :Z) and start a container at boot as a systemd service.
What you will learn
podman pull,podman run -d --name web -p 8080:80 image,podman ps,podman logs,podman exec -it web sh,podman stop/rm.- A rootless container runs as a regular user — even if compromised it is not root; it cannot bind to ports below 1024.
- Binding a host directory:
-v /srv/web:/usr/share/nginx/html:Z—:Zsets the SELinux context (container_file_t). - Starting at boot: a Quadlet file
~/.config/containers/systemd/web.container→systemctl --user daemon-reload→start; andloginctl enable-linger. - Registry login:
podman login registry.redhat.io; image search withpodman search,/etc/containers/registries.conf.
The lesson has 5 key points, an explanation and 5 questions. It opens with a package.