Docker & Dockerfile Security Cheat Sheet

* [Docker Security Cheat Sheet](
* [Dockerfile Security Best Practices](
* [Top 20 Dockerfile best practices](

**Bonus1:** Do not forget to use [distroless/static:nonroot]( images, if possible.

**Bonus2:** I did small search to check whether this opened before. And just found this post: [What are your Dockerfile best practices? And which ones are harder to implement?]( by [/u/capitangolo]([OWASP® Foundation]( creates some cool [cheatsheet series](

[HN Thread](

4 thoughts on “Docker & Dockerfile Security Cheat Sheet”

  1. Thanks, this is a great set of bookmarks for reference.

    One question – I understand */var/run/docker.sock* should never be exposed in a docker run or compose file. However, container management tools like Portainer need this to function.

    So the only solution to this is to assume the additional risk and enable access?

  2. Some plug for my own work for some practical step-by-step tutorials for devs to follow:

    1. [10 best practices to containerize Node.js web applications with Docker](
    2. [10 Docker Security Best Practices](
    3. [Docker for Java developers: 5 things you need to know not to fail your security](


Leave a Comment