# Optimize and Secure Docker Containers

Docker configurations often become slow, oversized, insecure, or difficult to operate. This skill reviews them and proposes practical production-ready improvements.

## Install

```bash
npx skillstore add sickn33/docker-expert
```

## Metadata

- Status: approved
- Slug: sickn33-docker-expert
- Skillstore revision: r2
- Version status: missing
- Tree hash: 0b9b6c2834983c98fb66de64d2cf230d1474a33d288e686d0a771d954e16e9a2
- Author: sickn33
- GitHub username: sickn33
- License: MIT
- Repository: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/docker-expert
- Ref: f9e2c34b4f19c7f3e6b0a1e93227b5f77cc12526
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands, network, filesystem, env\_access
- Quality score: 69
- Public page: https://skillstore.pages.dev/skills/sickn33-docker-expert
- Manifest: https://skillstore.pages.dev/api/skills/sickn33-docker-expert/manifest

## Capabilities

- Inspects Docker versions, contexts, project files, images, and running containers.
- Designs multi-stage Dockerfiles with efficient dependency caching and minimal runtime images.
- Reviews non-root users, secret handling, capabilities, health checks, and base-image exposure.
- Creates Docker Compose patterns for dependencies, networks, volumes, resources, and health checks.
- Diagnoses slow builds, large images, networking failures, and development workflow problems.
- Suggests build, runtime, Compose, and vulnerability validation commands.

## Use Cases

- Reduce production image size: Refactor a large Dockerfile into cached build stages and a minimal non-root runtime stage.
- Harden container deployment: Review users, secrets, networks, capabilities, health checks, and resource controls before release.
- Stabilize local services: Improve Compose dependencies, volumes, health checks, and development overrides for reliable team workflows.

## Prompt Templates

### Review a Dockerfile

```
Review this Dockerfile for correctness, caching, image size, and security. Explain each recommended change.
```

### Optimize a build

```
Convert this Dockerfile into an efficient multi-stage build. Preserve runtime behavior and use a non-root final stage.
```

### Improve Docker Compose

```
Review these Compose services for dependencies, networks, secrets, volumes, health checks, and resource limits. Propose production-ready changes.
```

### Diagnose production containers

```
Analyze these build logs, image details, and runtime symptoms. Rank likely causes and provide a cautious validation sequence.
```

## Limitations

- Docker daemon access and required command-line tools must already be available.
- Generated configurations require testing against the actual application and deployment environment.
- Kubernetes, cloud container services, CI pipelines, and complex database persistence need specialized review.
- Example image versions and platform details may require updates for current projects.

## Best Practices

- Provide the current Dockerfile, Compose files, target platform, and production constraints.
- Review proposed commands before allowing Docker daemon or registry access.
- Validate changes with builds, health checks, image scans, and application tests.

## Anti Patterns

- Do not place secrets in Dockerfile instructions, image layers, or committed environment files.
- Do not assume minimal images include shells, package managers, or health-check utilities.
- Do not apply production changes without checking persistence, rollback, and resource requirements.

## Security Audit

- Audited at: 2026-07-23T22:38:06.158\+00:00
- Summary: The 48 static alerts are false positives caused by Markdown fences, localhost health checks, /dev/null redirection, and illustrative secret-management examples. No credential exfiltration or prompt injection is present. However, the validation sequence can stop an existing container named validation-test after an earlier command fails.

## Stats

- Views: 151
- Downloads: 24
- Favorites: 1
- Popularity score: 0
