container-schulung/listings/exercises/ex07-named-volume/commands.sh
Frank Engel 5aba4ecac2 ex06/ex07: writer als Daemon, exit mit Ctrl+C + Cleanup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 07:45:08 +02:00

15 lines
449 B
Bash
Executable file

#!/bin/bash
# Exercise 7 — Named Volumes (shared between containers)
podman volume create pizza
# Terminal 1: write dates into the volume (detached)
podman run -d --name writer -v pizza:/data busybox \
sh -c 'while true; do sleep 1; date >> /data/output; done'
# Terminal 2: watch the output (Ctrl+C to exit)
podman run --rm -v pizza:/data busybox tail -f /data/output
# Cleanup
podman stop writer && podman rm writer
podman volume rm pizza