Madhu Akula
A practical guide to writing secure Dockerfiles
#1about 2 minutes
Why Dockerfile security is a critical foundation
Dockerfiles act as the blueprint for container images, making their security essential for preventing supply chain attacks and infrastructure compromise.
#2about 5 minutes
Following official Docker best practices for images
Start with small base images, use multi-stage builds, and manage the build context with a .dockerignore file to create efficient and secure containers.
#3about 4 minutes
Advanced security practices for hardening Dockerfiles
Enhance security by running containers as a non-root user, using COPY instead of ADD, avoiding hardcoded secrets, and pulling from trusted image registries.
#4about 4 minutes
Using Docker BuildKit to handle secrets securely
Docker's BuildKit allows mounting secrets and forwarding SSH agents during the build process, preventing sensitive credentials from being stored in image layers.
#5about 5 minutes
Automating checks with linters like Hadolint and Dockle
Use automated linters like Hadolint for best practices and Dockle for CIS benchmark compliance to enforce security standards in your CI/CD pipeline.
#6about 2 minutes
Reducing attack surface with Docker-slim
Docker-slim minifies container images by removing unnecessary files and can automatically generate seccomp and AppArmor profiles to harden runtime security.
#7about 3 minutes
Analyzing image layers for security with Dive
The Dive tool provides a layer-by-layer inspection of a Docker image, helping to identify inefficiencies and potential security risks like backdoors.
#8about 4 minutes
Introducing Open Policy Agent for custom policies
Open Policy Agent (OPA) and its language Rego provide a general-purpose engine for enforcing custom, organization-specific security policies on structured data like Dockerfiles.
#9about 6 minutes
Writing custom Dockerfile policies with Conftest
Leverage Conftest to write and apply custom Rego policies that validate Dockerfiles against specific organizational rules, such as only allowing images from a trusted private registry.
#10about 2 minutes
Next steps for implementing Dockerfile security
Implement security best practices early using linters in your IDE, integrate automated checks into CI/CD pipelines, and create standardized custom policies for your organization.
Related jobs
Jobs that call for the skills explored in this talk.
Power Plus Communications
Mannheim, Germany
Intermediate
Senior
Docker
Kubernetes
+2
Matching moments
03:48 MIN
Automating formal processes risks losing informal human value
What 2025 Taught Us: A Year-End Special with Hung Lee
03:39 MIN
Breaking down silos between HR, tech, and business
What 2025 Taught Us: A Year-End Special with Hung Lee
03:28 MIN
Why corporate AI adoption lags behind the hype
What 2025 Taught Us: A Year-End Special with Hung Lee
02:44 MIN
Rapid-fire thoughts on the future of work
What 2025 Taught Us: A Year-End Special with Hung Lee
03:38 MIN
Balancing the trade-off between efficiency and resilience
What 2025 Taught Us: A Year-End Special with Hung Lee
04:57 MIN
Developing resilience by expanding your capacity for failure
What 2025 Taught Us: A Year-End Special with Hung Lee
04:27 MIN
Moving beyond headcount to solve business problems
What 2025 Taught Us: A Year-End Special with Hung Lee
04:22 MIN
Why HR struggles with technology implementation and adoption
What 2025 Taught Us: A Year-End Special with Hung Lee
Featured Partners
Related Videos
Securing Your Web Application Pipeline From Intruders
Milecia McGregor
Reusing apps between teams and environments through Containers
Adrian Kosmaczewski
Walking into the era of Supply Chain Risks
Vandana Verma
Turning Container security up to 11 with Capabilities
Mathias Tausig
DevSecOps: Security in DevOps
Aarno Aukia
Supply Chain Security and the Real World: Lessons From Incidents
Adrian Mouat
Securing Secrets in the GitOps era
Alex Soto
Compose the Future: Building Agentic Applications, Made Simple with Docker
Mark Cavage, Tushar Jain, Jim Clark & Yunong Xiao
Related Articles
View all articles



From learning to earning
Jobs that call for the skills explored in this talk.

Implemental Systems
Municipality of Madrid, Spain
GIT
DevOps
Gitlab
Docker
Kubernetes



Implemental Systems
Retortillo de Soria, Spain
GIT
DevOps
Gitlab
Docker
Kubernetes

Siemens AG
Berlin, Germany
C++
GIT
CMake
Linux
DevOps
+7

knowmad Mood
Barcelona, Spain
Remote
GIT
Bash
Redis
DevOps
+9

knowmad Mood
Lleida, Spain
Remote
GIT
Bash
Redis
DevOps
+9

knowmad Mood
A Coruña, Spain
Remote
GIT
Bash
Redis
DevOps
+9

knowmad Mood
Municipality of Madrid, Spain
Remote
GIT
Bash
DevOps
Python
+7