Product
Everything you need to secure code, cloud, and runtime– in one central system
Code
Dependencies
Prevent open-source risks (SCA)
Secrets
Catch exposed secrets
SAST
Secure code as its written
Container Images
Secure images easily
Malware
Prevent supply chain attacks
Infrastructure as Code
Scan IaC for misconfigurations
License Risk & SBOMs
Avoid risk, be compliant
Outdated Software
Know your EOL runtimes
Cloud
Cloud / CSPM
Cloud misconfigurations
DAST
Black-box security testing
API Scanning
Test your API’s for vulns
Virtual Machines
No agents, no overhead
Kubernetes Runtime
soon
Secure your container workloads
Cloud Inventory
Cloud sprawl, solved
Defend
Runtime Protection
In-app Firewall / WAF
Features
AI AutoFix
1-click fixes with Aikido AI
CI/CD Security
Scan before merge and deployment
IDE Integrations
Get instant feedback while coding
On-Prem Scanner
Compliance-first local scanning
Solutions
Use Cases
Compliance
Automate SOC 2, ISO & more
Vulnerability Management
All-in-1 vuln management
Secure Your Code
Advanced code security
Generate SBOMs
1 click SCA reports
ASPM
End-to-end AppSec
AI at Aikido
Let Aikido AI do the work
Block 0-Days
Block threats before impact
Industries
FinTech
HealthTech
HRTech
Legal Tech
Group Companies
Agencies
Startups
Enterprise
Mobile apps
Manufacturing
Pricing
Resources
Developer
Docs
How to use Aikido
Public API docs
Aikido developer hub
Changelog
See what shipped
Security
In-house research
Malware & CVE intelligence
Glossary
Security jargon guide
Trust Center
Safe, private, compliant
Open Source
Aikido Intel
Malware & OSS threat feed
Zen
In-app firewall protection
OpenGrep
Code analysis engine
Integrations
IDEs
CI/CD Systems
Clouds
Git Systems
Compliance
Messengers
Task Managers
More integrations
About
About
About
Meet the team
Careers
We’re hiring
Press Kit
Download brand assets
Calendar
See you around?
Open Source
Our OSS projects
Blog
The latest posts
Customer Stories
Trusted by the best teams
Contact
Login
Start for Free
No CC required
Aikido
Menu
Aikido
EN
EN
FR
JP
Login
Start for Free
No CC required
Blog
/
A no-BS Docker security checklist for the vulnerability-minded developer

A no-BS Docker security checklist for the vulnerability-minded developer

By
Mackenzie Jackson
Mackenzie Jackson
4 min read
Guides

Why are you here?

You want to know the real answer to two questions about Docker security:

Is Docker secure for production use?

‍Yes and no. Docker uses a security model that relies on namespaces and resource isolation, making the processes within more secure from specific attacks than running your applications directly from a cloud VM or bare metal system.Despite that layer, there are still plenty of ways for attackers to access your container, allowing them to read confidential information, run denial-of-service (DoS) attacks, or even gain root access to the host system.

How can I improve my Docker security (in a not terribly painful way)?

‍We’ll walk you through the most common and severe Docker vulnerabilities, skipping over the basic recommendations you’ll find all over Google, like using official images and keeping your host up to date.Instead, we’ll lead you directly to new docker options and Dockerfile lines that will make your new default Docker container deployment far more secure than ever.

Via @sidpalas on Twitter/X: https://x.com/sidpalas/status/1638558418830233600

The no-BS Docker security checklist

Make in-container filesystems read-only

What do you gain?

You prevent an attacker from editing the runtime environment of your Docker container, which could allow them to collect useful information about your infrastructure, gather user data, or conduct a DOS or ransomware attack directly.

How do you set it?

You have two options, either at runtime or within your Docker Compose configuration.

At runtime: docker run --read-only your-app:v1.0.1

In your Docker Compose file:

services:
webapp:
image: your-app:v1.0.1read_only: true
...

Lock privilege escalation

What do you gain?

You keep your Docker container—or an attacker who is mucking about inside said container—from enabling new privileges, even root-level, with setuid or setgid. With more permissive access to your container, an attacker could access credentials in the form of passwords or keys to connected parts of your deployment, like a database.

How do you set it?

Once again, at runtime or within your Docker Compose configuration.

At runtime: docker run --security-opt=no-new-privileges your-app:v1.0.1

In your Docker Compose file:

services:  
	webapp:    
		image: your-app:v1.0.1    
		security_opt:      
			- no-new-privileges:true    
		...

Isolate your container-to-container networks

What do you gain?

By default, Docker lets all containers communicate via the docker0 network, which might allow an attacker to move laterally from one compromised container to another. If you have discrete services A and B in containers Y and Z, and they don’t need to communicate directly, isolating their networks provides the same end-user experience while preventing lateral movement for better Docker security.

How do you set it?

You can specify Docker networks at runtime or within your Docker Compose configuration. However, you first need to create the network:

docker network create your-isolated-network

At runtime, add the --network option: docker run --network your-isolated-network your-app:v1.0.1

Or the equivalent option in your Docker Compose file:

services:  
	webapp:    
    	image: your-app:v1.0.1    
        networks:      
        	- your-isolated-network    
		...

Set a proper non-root user

What do you gain?

The default user within a container is root, with a uid of 0. By specifying a distinct user, you prevent an attacker from escalating their privileges to another user that can take action without restrictions, like root, which would override any other Docker security measures you’ve worked hard to implement.

How do you set it?

Create your user during the build process or a runtime. At runtime, you can either create the user for the first time, or override the USER you already set at build.

During the build process, in your Dockerfile:

...
RUN groupadd -r your-user
RUN useradd -r -g your-user your-user
USER myuser
...

‍

At runtime: docker run -u your-user your-app:v1.0.1

Drop Linux kernel capabilities

What do you gain?

By default, Docker containers are allowed to use a restricted set of Linux kernel capabilities. You might think the folks at Docker created that restricted set to be completely secure, but many capabilities exist for compatibility and simplicity. For example, default containers can arbitrarily change ownership on files, change their root directory, manipulate process UIDs, and read sockets. By dropping some or all of these capabilities, you minimize the number of attack vectors.

How do you set it?

You can drop capabilities and set new ones at runtime. For example, you could drop all kernel capabilities and allow your container only the capability to change ownership of existing files.

docker run --cap-drop ALL --cap-add CHOWN your-app:v1.0.1

‍

Or for Docker Compose:

services:
	webapp:
    	image: your-app:v1.0.1
        cap_drop:
        	- ALL
        cap_add:
        	- CHOWN
        ...

Prevent fork bombs

What do you gain?

Fork bombs are a type of DoS attack that infinitely replicates an existing process. First, they reduce performance and restrict resources, which inevitably raises costs and can ultimately crash your containers or the host system. Once a fork bomb has started, there’s no way to stop it other than restarting the container or the host.

How do you set it?

At runtime, you can limit the number of processes (PIDs) your container can create.

docker run --pids-limit 99 your-app:v1.0.1

‍

Or with Docker Compose:

services:
	webapp:
		image: your-app:v1.0.1
		deploy
			limits:
				pids: 99

‍

Improve Docker security by monitoring your open source dependencies

What do you gain?

The applications you’ve containerized for deployment with Docker likely have a wide tree of dependencies.

How do you set it?

The most “non-BS” way is with Aikido’s open-source dependency scanning. Our continuous monitoring scans projects written in more than a dozen languages based on the presence of lockfiles within your application and delivers an instant overview of vulnerabilities and malware. With automatic triaging that filters out false positives, Aikido gives you remediation advice you can start working with right away… not only after you read a dozen other reference documents and GitHub issues.

At Aikido, we love established open-source projects like Trivy, Syft, and Grype. We also know from experience that using them in isolation isn’t a particularly good developer experience. Under the hood, Aikido enhances these projects with custom rules to bridge gaps and reveal security flaws you wouldn’t be able to find otherwise. Unlike chaining various open-source tools together, Aikido frees you from having to build a scanning script or create a custom job in your CI/CD.

Open source dependency scanning in Aikidio for more complete Docker security.
Type caption (optional)

Use only trusted images for Docker security

What do you gain?

Docker Content Trust (DCT) is a system for signing and validating the content and integrity of the official images you pull from Docker registries like Docker Hub. Pulling only images signed by the author gives you more reassurance they haven’t been tampered with to create vulnerabilities in your deployment.

How do you set it?

The easiest way is to set the environment variable on your shell, which prevents you or anyone else from working with untrusted images.

export DOCKER_CONTENT_TRUST=1
docker run ...

Or, you can set the environment variable each time you execute Docker:

DOCKER_CONTENT_TRUST=1 docker run …

Update end-of-life (EOL) runtimes

What do you gain?

One common recommendation for Docker container security is to pin images and dependencies to a specific version instead of latest. In theory, that prevents you from unknowingly using new images, even ones that have been tampered with, that introduce new vulnerabilities.

How do you set it?

You have some open-source projects available to help you discover EOLs and best prepare. The endoflife.date project (GitHub repository) tracks more than 300 products by aggregating data from multiple sources and making it available via a public API. You have a few options with endoflife.date and similar projects:

  • Manually check the project for updates on dependencies your applications rely on and create tickets or issues for required updates.
  • Write a script (Bash, Python, etc.) to get the EOL dates of dependencies from the API and run it regularly, like a cron job.
  • Incorporate the public API, or that custom script, into your CI platform to fail builds that use a project that’s nearing or reached EOL.

As a developer, we understand that your time is valuable and often limited. This is where Aikido can provide a sense of security—our EOL scanning feature tracks your code and containers, prioritizing runtimes with the most impact and exposure, like Node.js or an Nginx web server. As usual, we not only automate collecting information, but deliver alerts with appropriate severity to inform, not overwhelm you.

An example of improving Docker security by scanning for end-of-life dependencies.
An

Limit container resource usage

What do you gain?

By default, containers have no resource constraints and will use as much memory or CPU as the host’s scheduler. Limiting the resource usage of a specific container can minimize the impact of a DoS attack. Instead of crashing your container or host system due to an Out of Memory Exception, the ongoing DoS attack will “only” negatively impact the end-user experience.

How do you set it?

At runtime, you can use the --memory and --cpus option to set limits for memory and CPU usage, respectively. The memory option takes numbers with g for gigabytes and m for megabytes, while the CPU option reflects the limit of dedicated CPUs available for the container and its processes.

docker run --memory="1g" --cpus="2" your-app:v1.0.1

This also works with Docker Compose:

services:
	webapp:
    	image: your-app:v1.0.1
        deploy:
            limits:
            	cpus: '2'
                memory: 1G
         ...

Your final command and Compose options for Docker security

By now you’ve seen quite a few Docker security tips and the relevant CLI options or configuration to go along with them, which means you’re either quite excited to implement them or overwhelmed with how to piece them all together. Below, we’ve rolled up all the recommendations into a single command or configuration template, which will help you start deploying more secure Docker containers right away.

Obviously, you’ll want to change some of the options—like the non-root user name, kernel capabilities, resource limits—based on your application’s needs.

export DOCKER_CONTENT_TRUST=1
docker run \  
    --read-only \  
    --security-opt=no-new-privileges \  
    --network your-isolated-network \  
    --cap-drop ALL 
    --cap-add CHOWN \  
    --pids-limit 99 \  
    --memory="1g" --cpus="2" \  
    --user=your-user \  
    ...                 # OTHER OPTIONS GO HERE  
    your-app:v1.0.1

You might even want to create a drun alias with your host’s shell you can invoke without having to remember all those details.

function drun {  
docker run \   
    	--read-only \    
        --security-opt=no-new-privileges \    
        --network your-isolated-network \    
        --cap-drop ALL 
        --cap-add CHOWN \    
        --pids-limit 99 \    
        --memory="1g" --cpus="2" \    
        --user=your-user \    
        $1 \    
        $2
}

Then run your alias like so, with your options and image name: drun -it your-app:v1.0.1

If you’re a Docker Compose kind of person, you can adapt all the same options into a new baseline Docker Compose template you can work from in the future:

services:
	webapp:
    	image: your-app:v1.0.1
        read_only: true
        security_opt:
           - no-new-privileges:true
        networks:
           - your-isolated-network
        cap_drop:
           - ALL
        cap_add:
           - CHOWN
        deploy:
        	limits:
        		pids: 9
        		cpus: '2'
        		memory: 1G
        ...               # OTHER OPTIONS GO HERE

Bonus: Run Docker with rootless containers

When you install Docker on any system, its daemon operates with root-level privileges. Even if you enable all the options above, and prevent privilege escalation within a Docker container, the rest of the container runtime on your host system still has root privileges. That inevitably widens your attack surface.

The solution is rootless containers, which an unprivileged user can create and manage. No root privileges involved means far fewer security issues for your host system.

We wish we could help you use rootless containers with a single option or command, but it’s just not that simple. You can find detailed instructions at the Rootless Containers website, including a how-to guide for Docker.

What’s next for your Docker security?

‍

If you’ve learned anything from this experience, it’s that container security is a long-tail operation. There are always more hardening checklists and deep-dive articles to read about locking down your containers in Docker or its older and often misunderstood cousin, Kubernetes. You can’t possibly aim for faultless container security—creating time in your busy development schedule to address security, and then making incremental improvements based on impact and severity, will go a long way over time.

To help you maximize on that continuous process and prioritize fixes that will meaningfully improve your application security, there’s Aikido. We just raised a $17 million Series A for our “no BS” developer security platform, and we’d love to have you join us.

Written by Mackenzie Jackson

Share:

https://www.aikido.dev/blog/a-no-bs-docker-security-checklist-for-the-vulnerability-minded-developer

Table of contents:
Text Link
Share:
Use keyboard
Use left key to navigate previous on Aikido slider
Use right arrow key to navigate to the next slide
to navigate through articles
By
Charlie Eriksen

You're Invited: Delivering malware via Google Calendar invites and PUAs

Malware
May 13, 2025
Read more
By
Mackenzie Jackson

Why Updating Container Base Images is So Hard (And How to Make It Easier)

Engineering
May 12, 2025
Read more
By
Charlie Eriksen

RATatouille: A Malicious Recipe Hidden in rand-user-agent (Supply Chain Compromise)

May 6, 2025
Read more
By
Charlie Eriksen

XRP supply chain attack: Official NPM package infected with crypto stealing backdoor

Malware
April 22, 2025
Read more
By
Charlie Eriksen

The malware dating guide: Understanding the types of malware on NPM

Malware
April 10, 2025
Read more
By
Charlie Eriksen

Hide and Fail: Obfuscated Malware, Empty Payloads, and npm Shenanigans

Malware
April 3, 2025
Read more
By
Madeline Lawrence

Launching Aikido Malware – Open Source Threat Feed

News
March 31, 2025
Read more
By
Charlie Eriksen

Malware hiding in plain sight: Spying on North Korean Hackers

March 31, 2025
Read more
By
The Aikido Team

Top Cloud Security Posture Management (CSPM) Tools in 2025

Guides
March 27, 2025
Read more
By
Madeline Lawrence

Get the TL;DR: tj-actions/changed-files Supply Chain Attack

News
March 16, 2025
Read more
By
Mackenzie Jackson

Sensing and blocking JavaScript SQL injection attacks

Guides
March 4, 2025
Read more
By
Floris Van den Abeele

Prisma and PostgreSQL vulnerable to NoSQL injection? A surprising security risk explained

Engineering
February 14, 2025
Read more
By
The Aikido Team

Top Dynamic Application Security Testing (DAST) Tools in 2025

Guides
February 12, 2025
Read more
By
Willem Delbare

Launching Opengrep | Why we forked Semgrep

News
January 24, 2025
Read more
By
Thomas Segura

Your Client Requires NIS2 Vulnerability Patching. Now What?

January 14, 2025
Read more
By
Mackenzie Jackson

Top 10 AI-powered SAST tools in 2025

Guides
January 10, 2025
Read more
By
Madeline Lawrence

Snyk vs Aikido Security | G2 Reviews Snyk Alternative

Guides
January 10, 2025
Read more
By
Mackenzie Jackson

Top 10 Software Composition Analysis (SCA) tools in 2025

Guides
January 9, 2025
Read more
By
Michiel Denis

3 Key Steps to Strengthen Compliance and Risk Management

December 27, 2024
Read more
By
Mackenzie Jackson

The Startup's Open-Source Guide to Application Security

Guides
December 23, 2024
Read more
By
Madeline Lawrence

Launching Aikido for Cursor AI

Engineering
December 13, 2024
Read more
By
Mackenzie Jackson

Meet Intel: Aikido’s Open Source threat feed powered by LLMs.

Engineering
December 13, 2024
Read more
By
Johan De Keulenaer

Aikido joins the AWS Partner Network

News
November 26, 2024
Read more
By
Mackenzie Jackson

Command injection in 2024 unpacked

Engineering
November 24, 2024
Read more
By
Mackenzie Jackson

Path Traversal in 2024 - The year unpacked

Engineering
November 23, 2024
Read more
By
Mackenzie Jackson

Balancing Security: When to Leverage Open-Source Tools vs. Commercial Tools

Guides
November 15, 2024
Read more
By
Mackenzie Jackson

The State of SQL Injection

Guides
November 8, 2024
Read more
By
Michiel Denis

Visma’s Security Boost with Aikido: A Conversation with Nikolai Brogaard

News
November 6, 2024
Read more
By
Michiel Denis

Security in FinTech: Q&A with Dan Kindler, co-founder & CTO of Bound

News
October 10, 2024
Read more
By
Felix Garriau

Top 7 ASPM Tools in 2025

Guides
October 1, 2024
Read more
By
Madeline Lawrence

Automate compliance with SprintoGRC x Aikido

News
September 11, 2024
Read more
By
Felix Garriau

How to Create an SBOM for Software Audits

Guides
September 9, 2024
Read more
By
Madeline Lawrence

SAST vs DAST: What you need to know.

Guides
September 2, 2024
Read more
By
Felix Garriau

Best SBOM Tools for Developers: Our 2025 Picks

Guides
August 7, 2024
Read more
By
Lieven Oosterlinck

5 Snyk Alternatives and Why They Are Better

News
August 5, 2024
Read more
By
Madeline Lawrence

Why we’re stoked to partner with Laravel

News
July 8, 2024
Read more
By
Felix Garriau

110,000 sites affected by the Polyfill supply chain attack

News
June 27, 2024
Read more
By
Felix Garriau

Cybersecurity Essentials for LegalTech Companies

News
June 25, 2024
Read more
By
Roeland Delrue

Drata Integration - How to Automate Technical Vulnerability Management

Guides
June 18, 2024
Read more
By
Joel Hans

DIY guide: ‘Build vs buy’ your OSS code scanning and app security toolkit

Guides
June 11, 2024
Read more
By
Roeland Delrue

SOC 2 certification: 5 things we learned

Guides
June 4, 2024
Read more
By
Joel Hans

Top 10 app security problems and how to protect yourself

Guides
May 28, 2024
Read more
By
Madeline Lawrence

We just raised our $17 million Series A

News
May 2, 2024
Read more
By

Best RASP Tools for Developers in 2025

April 10, 2024
Read more
By
Willem Delbare

Webhook security checklist: How to build secure webhooks

Guides
April 4, 2024
Read more
By
Willem Delbare

The Cure For Security Alert Fatigue Syndrome

Engineering
February 21, 2024
Read more
By
Roeland Delrue

NIS2: Who is affected?

Guides
January 16, 2024
Read more
By
Roeland Delrue

ISO 27001 certification: 8 things we learned

Guides
December 5, 2023
Read more
By
Roeland Delrue

Cronos Group chooses Aikido Security to strengthen security posture for its companies and customers

News
November 30, 2023
Read more
By
Bart Jonckheere

How Loctax uses Aikido Security to get rid of irrelevant security alerts & false positives

News
November 22, 2023
Read more
By
Felix Garriau

Aikido Security raises €5m to offer a seamless security solution to growing SaaS businesses

News
November 9, 2023
Read more
By
Roeland Delrue

Aikido Security achieves ISO 27001:2022 compliance

News
November 8, 2023
Read more
By
Felix Garriau

How StoryChief’s CTO uses Aikido Security to sleep better at night

News
October 24, 2023
Read more
By
Willem Delbare

What is a CVE?

Guides
October 17, 2023
Read more
By
Felix Garriau

Best Tools for End-of-Life Detection: 2025 Rankings

Guides
October 4, 2023
Read more
By
Willem Delbare

Top 3 web application security vulnerabilities in 2024

Engineering
September 27, 2023
Read more
By
Felix Garriau

New Aikido Security Features: August 2023

News
August 22, 2023
Read more
By
Felix Garriau

Aikido’s 2025 SaaS CTO Security Checklist

News
August 10, 2023
Read more
By
Felix Garriau

Aikido’s 2024 SaaS CTO Security Checklist

News
August 10, 2023
Read more
By
Felix Garriau

15 Top Cloud and Code Security Challenges Revealed by CTOs

Engineering
July 25, 2023
Read more
By
Willem Delbare

What is OWASP Top 10?

Guides
July 12, 2023
Read more
By
Willem Delbare

How to build a secure admin panel for your SaaS app

Guides
July 11, 2023
Read more
By
Roeland Delrue

How to prepare yourself for ISO 27001:2022

Guides
July 5, 2023
Read more
By
Willem Delbare

Preventing fallout from your CI/CD platform being hacked

Guides
June 19, 2023
Read more
By
Felix Garriau

How to Close Deals Faster with a Security Assessment Report

News
June 12, 2023
Read more
By
Willem Delbare

Automate Technical Vulnerability Management [SOC 2]

Guides
June 5, 2023
Read more
By
Willem Delbare

Preventing prototype pollution in your repository

Guides
June 1, 2023
Read more
By
Willem Delbare

How does a SaaS startup CTO balance development speed and security?

Guides
May 16, 2023
Read more
By
Willem Delbare

How a startup’s cloud got taken over by a simple form that sends emails

Engineering
April 10, 2023
Read more
By
Felix Garriau

Aikido Security raises €2 million pre-seed round to build a developer-first software security platform

News
January 19, 2023
Read more
By

Why Lockfiles Matter for Supply Chain Security

Read more
Top Cloud Security Posture Management (CSPM) Tools in 2025
By
The Aikido Team

Top Cloud Security Posture Management (CSPM) Tools in 2025

Guides
May 14, 2025
Top Dynamic Application Security Testing (DAST) Tools in 2025
By
The Aikido Team

Top Dynamic Application Security Testing (DAST) Tools in 2025

Guides
May 14, 2025
XRP supply chain attack: Official NPM package infected with crypto stealing backdoor
By
Charlie Eriksen

XRP supply chain attack: Official NPM package infected with crypto stealing backdoor

Malware
March 31, 2025

Get secure in 32 seconds

Connect your GitHub, GitLab, Bitbucket or Azure DevOps account to start scanning your repos for free.

Start for Free
Your data won't be shared · Read-only access
Aikido dashboard
Company
ProductPricingAboutCareersContactPartner with us
Resources
DocsPublic API DocsVulnerability DatabaseBlogIntegrationsGlossaryPress KitCustomer Reviews
Security
Trust CenterSecurity OverviewChange Cookie Preferences
Legal
Privacy PolicyCookie PolicyTerms of UseMaster Subscription AgreementData Processing Agreement
Use Cases
ComplianceSAST & DASTASPMVulnerability ManagementGenerate SBOMsWordPress SecuritySecure Your CodeAikido for Microsoft
Industries
For HealthTechFor MedTechFor FinTechFor SecurityTechFor LegalTechFor HRTechFor AgenciesFor EnterpriseFor PE & Group Companies
Compare
vs All Vendorsvs Snykvs Wizvs Mendvs Orca Securityvs Veracodevs GitHub Advanced Securityvs GitLab Ultimatevs Checkmarxvs Semgrepvs SonarQube
Connect
hello@aikido.dev
LinkedInX
Subscribe
Stay up to date with all updates
Not quite there yet.
👋🏻 Thank you! You’ve been subscribed.
Team Aikido
Not quite there yet.
© 2025 Aikido Security BV | BE0792914919
🇪🇺 Registered address: Coupure Rechts 88, 9000, Ghent, Belgium
🇪🇺 Office address: Gebroeders van Eyckstraat 2, 9000, Ghent, Belgium
🇺🇸 Office address: 95 Third St, 2nd Fl, San Francisco, CA 94103, US
SOC 2
Compliant
ISO 27001
Compliant