Run a hardened read-only container
Read-only root filesystem, only /tmp is writable, no privilege escalation; basic container hardening
docker run --read-only --tmpfs /tmp --security-opt no-new-privileges --cap-drop ALL <name>
- tool
- docker46 commands
More docker commands
-
docker events --filter event=oom --filter type=containerStreams OOM events live to catch containers killed for hitting the memory limit
-
docker buildx build --platform linux/amd64,linux/arm64 -t reg/img:tag --push .Builds the image for amd64 and arm64 with BuildKit and pushes it straight to the registry
-
docker run --rm -it --env-file .env -p 8000:8000 img:tagLocal run with variables from .env; --rm deletes the container on exit
-
docker history --no-trunc img:tagShows each layer with its command and size; helps find what makes the image so big
-
docker system prune -af --volumesDeletes stopped containers and all unused images, networks and volumes