Skip to content
Back to skills

Docker Security Hardening

ASecurity

Use when hardening Docker containers and images.

  • 2 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 10, 2026
ai-agentsgoshellnodedockersecurity

Security analysis

A93/100
  • highPerforms destructive filesystem operations

Pro shows the line behind each finding and how to fix it

Scanned September 10, 2026

npx -y skills add LoopyLuci/Skills --skill docker-security-hardening --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Docker Security Hardening?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Docker Security Hardening
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/loopyluci-docker-security-hardening/badge)](https://www.skillsdirectory.com/skills/loopyluci-docker-security-hardening)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: docker-security-hardening
description: "Use when hardening Docker containers and images."
category: docker
tags: [docker, security, hardening, scanning]
---
# Docker Security Hardening

Hardening containers and images.

## Non-Root User
```dockerfile
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
COPY --chown=appuser:appgroup . /app
```

## Read-Only Rootfs
```powershell
docker run --read-only --tmpfs /tmp --tmpfs /var/run myapp
```

## Drop Capabilities
```powershell
docker run --cap-drop ALL --cap-add NET_BIND_SERVICE myapp
```

## Image Scanning
```powershell
docker scout quickview myapp:latest
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \\
    aquasec/trivy image myapp:latest
```

## Secrets (don't bake in)
```powershell
docker run --secret id=db_pass,src=./secrets/db_pass.txt myapp
```

## Dockerfile
```dockerfile
RUN apt-get update && apt-get install -y --no-install-recommends pkg \\
    && rm -rf /var/lib/apt/lists/*
FROM node:20.11.0-alpine3.18    # pin versions, not "latest"
```

## Pitfalls
- "latest" tags change -- pin versions
- Env vars with secrets leak to docker history -- use --secret
- --privileged defeats all security -- avoid

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.