Docker Security notes
- Gebruik user namespace remapping om containers te isoleren: een root-proces in de container wordt dan niet automatisch host‑root, wat privilege‑escalatie voorkomt.
- Munt nooit /var/run/docker.sock in een container; toegang geeft volledige controle over de Docker daemon en de host.
- Let op UID/GID-mapping: container‑UID’s worden naar andere host‑UID’s vertaald, wat gevolgen heeft voor bestandspermissies bij bind-mounts.
- Gebruik AppArmor en drop capabilities en filesystem paths die niet nodig zijn. Let op: bij Alpine/busybox images kun je bijvoorbeeld /bin/sh niet blokkeren vanwege symlinks naar /bin/busybox; overweeg daarom geen Alpine/busybox image als je strikte AppArmor-regels wilt zoals het blokkeren van /bin/sh.
- Standaard UFW blokkeert geen container‑poorten zoals 443; gebruik aanvullende firewallregels (zoals ufw-docker)
- Secrets in images lekken via laag‑inspectie (tools zoals dive).
LINKS:
https://docs.docker.com/engine/security/userns-remap/ https://docs.docker.com/engine/security/apparmor/ https://gitlab.com/apparmor/apparmor/-/wikis/Documentation https://gitlab.com/apparmor/apparmor/-/blob/master/profiles/apparmor.d/abstractions/base https://gtfobins.github.io/gtfobins/docker/ https://github.com/wagoodman/dive https://book.hacktricks.wiki/en/linux-hardening/privilege-escalation/docker-security/index.html https://github.com/chaifeng/ufw-docker https://github.com/docker/docker-bench-security
