Linux+ 2.6.3: Container storage and networks
A bind mount that SELinux allows, a named volume that outlives its containers, and name resolution on a user-defined network, all rootless.
Before you start
The VM needs internet access to pull images. The lab installs Podman and
creates user alice (password Lab-Pass-1), with lingering turned on so
her user services run. Do every task as alice: log in as her, or use
sudo -iu alice and then export XDG_RUNTIME_DIR=/run/user/$(id -u).
Docker Hub limits anonymous pulls; if you hit the limit, use
mirror.gcr.io/library/... instead of docker.io/library/.... Leave the
containers, the volume and the network in place for grading.
Tasks
- Put an
index.htmlin~/site, and runnginx:1.30as a container namedsiteon host port 8080 that serves~/siteread-only from/usr/share/nginx/html. On RHEL relatives, keep SELinux enforcing: run it once without a label option and see the 403, then fix it. - Create the volume
labdata. Write the date tofirst.txtin it from onealpine:3.24container, and read it back from another. - Create the network
labnetand runnginx:1.30on it as a container namedback. From another container onlabnet, fetchhttp://backby name.
Hints
podman run -d --name site -p 8080:80 -v ~/site:/usr/share/nginx/html:ro, then:ro,Z;curl -s http://127.0.0.1:8080,ls -Zd ~/site.podman volume create,podman run --rm -v labdata:/data docker.io/library/alpine:3.24 sh -c 'date > /data/first.txt'.podman network create,podman run --network labnet,wget -qO- http://backfrom an alpine container.