Interview Prep/Docker/Image Security & Hardening

How do you make sure an image runs on OpenShift or other random-UID platforms?

IntermediateProductionImage Security & Hardening
Answer

OpenShift runs containers with a random UID in group 0. Make writable directories group-writable and owned by root group: chgrp -R 0 /app/data && chmod -R g=u /app/data, avoid writing to the home directory, don't depend on a specific UID in /etc/passwd, and listen on ports above 1024.

All Docker questions Roadmap: Docker & containers

More on Image Security & Hardening