Podman Volumes and Web Containers
podmancontainersapachevolumes
Follow Installing Podman and Understanding Containers first. A container should be replaceable; content that must survive replacement belongs in a volume or bind mount.
Create website content
mkdir -p ~/containers/site
printf '%s\n' '<h1>Hello from Podman</h1>' > ~/containers/site/index.html
Run Apache
podman run --name web-demo --detach \
--publish 8080:80 \
--volume "$HOME/containers/site:/usr/local/apache2/htdocs:ro" \
docker.io/library/httpd:2.4
The host port is 8080; Apache listens on port 80 inside the container. The mount is read-only because Apache only needs to serve the files.
Verify
curl http://127.0.0.1:8080
podman ps
podman logs web-demo
podman port web-demo
If the port is already in use, choose another host port. Do not solve conflicts by publishing the service on every interface unless remote access is required.
Cleanup
podman stop web-demo
podman rm web-demo
The host content remains because it is a bind mount. Continue with Podman Multi-Container Web and Database Stacks.