- listings/exercises/ex05-ex15: alle Übungsdateien für Tag 2 (Networking, Bind Mounts, Volumes, Env Variables, Compose, Build, Push, Registry) - setup/setup-ubuntu2404.sh: Prep-Script für Ubuntu 24.04 (Noble) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
18 lines
489 B
Bash
Executable file
18 lines
489 B
Bash
Executable file
#!/bin/bash
|
|
# Exercise 8 — Volume Persistence (data survives container removal)
|
|
|
|
podman volume create pasta
|
|
|
|
# Create a file inside the container
|
|
podman run -v pasta:/data --name pasta --rm -ti busybox \
|
|
sh -c 'touch /data/hello && echo "file created"'
|
|
|
|
# Container is gone — volume still exists
|
|
podman volume inspect pasta
|
|
|
|
# New container, same volume (different mountpoint)
|
|
podman run -v pasta:/mnt --name pasta2 --rm -ti busybox \
|
|
ls -la /mnt
|
|
|
|
# Cleanup
|
|
podman volume rm pasta
|