A hands-on lab toolkit for container security, from CIS-benchmark fundamentals to architectural trust governance. 12 production-grade labs covering image hardening, signing, supply chain attestation, admission control, and runtime debugging. Designed around reproducible, production-oriented container security scenarios.
43
stars
17
commits
Shell
primary language
Aug 1, 2026
updated
A hands-on Docker and container security guide built around reproducible labs, attack scenarios, defensive controls, and production-oriented validation.
The repository progresses from foundational Docker hardening to runtime escape analysis, secrets management, software supply-chain trust, AI-assisted remediation, and AI context-poisoning defenses.
/proc or /sys exposureThis guide is part of OpsCart Labs, a collection of open-source, hands-on labs informed by production cloud and Kubernetes operations.
Docker Security: A Practical Guide — this repository
Certified Kubernetes Administrator Exam Prep
Use this section as the central entry point for the repository.
| Area | Purpose |
|---|---|
| Lab Catalog | Select a hands-on lab by security domain or learning level |
| Publications and Research | Connect formal research, CNCF publications, practitioner articles, and implementation evidence |
| Additional Resources | Browse official documentation, standards, security tools, and primary research |
| Setup Guide | Prepare Docker, shared tooling, and the common lab environment |
| Troubleshooting Guide | Diagnose shared Docker, Compose, networking, tooling, and Kubernetes problems |
| Repository Issues | Report broken links, reproducibility problems, or documentation corrections |
Some topics evolve independently of this repository or require deeper experimentation than fits within the Docker Security Guide. These companion repositories provide verified implementations, extended experiments, and specialized documentation.
| Project | Description |
|---|---|
| Docker Sandbox DevOps | Dedicated companion repository for Docker Sandboxes, AI coding-agent isolation, Kubernetes debugging, and DevOps toolkit experiments. |
Each lab has its own README with prerequisites, detailed steps, validation, expected results, and cleanup instructions. The root README intentionally provides a concise catalog so lab-specific documentation remains the source of truth.
Run Docker Bench Security, interpret CIS-aligned findings, identify dangerous configurations, and review practical remediations.
Estimated time: 30–45 minutes
Compare insecure and hardened configurations using capability controls, read-only filesystems, tmpfs, non-root execution, and no-new-privileges.
Estimated time: 45–60 minutes
Scan images with Trivy, generate SBOMs with Syft, analyze them with Grype, and enforce vulnerability policy with OPA.
Estimated time: 60–90 minutes
Sign and verify images with Cosign, examine content trust, manage signing keys, and enforce image-signing policy.
Estimated time: 45–60 minutes
Understand Linux syscalls, examine Docker's default seccomp behavior, generate restrictive profiles, and validate them without breaking workloads.
Estimated time: 90–120 minutes
Harden containerized ML inference with resource controls, input validation, monitoring, and Kubernetes security settings.
Estimated time: 60–90 minutes
Generate and compare SBOMs, scan them for vulnerabilities, and integrate supply-chain checks into GitHub Actions and Azure Pipelines.
Estimated time: 45–60 minutes
Practice network isolation, multi-tier segmentation, internal networks, TLS encryption, and common network-misconfiguration remediation.
Estimated time: 18–22 minutes
Explore Docker socket escape, privileged containers, CAP_SYS_ADMIN, host mounts, and /proc or /sys exposure, then apply Falco, Kyverno, and audit-script defenses.
Run offensive scenarios only in an isolated disposable environment. Do not use a production host.
Estimated time: 2–2.5 hours
Study secret leakage anti-patterns, Docker Swarm secrets, Vault integration, BuildKit secret mounts, repository scanning, and audit/compliance evidence.
Scenarios:
Estimated time: approximately 90 minutes
Build an AutoGen-based agent that uses GPT-3.5-turbo and a secured MCP server to inspect logs, restart containers, update resources, and escalate unsafe or uncertain remediation decisions.
The security pipeline includes HMAC authentication, Redis-backed rate limiting, input validation, audit logging, non-root execution, read-only filesystems, dropped capabilities, and resource limits.
Scenarios: OOM remediation, crash escalation, exit-code retry logic, and health-check recovery.
Estimated time: 60–90 minutes
Build a vendor-neutral trust-control architecture using hardened images, Kyverno admission policies, Cosign, SBOM and provenance attestations, phased enforcement, break-glass controls, and fleet drift analysis.
Experiments:
Estimated time: 90–120 minutes
Test zero-width Unicode instruction injection and malicious agent hooks against controlled projects, compare Claude Code and Gemini CLI behavior, and validate Docker Sandboxes as an infrastructure-level defense.
The lab documents two independent defenses:
Estimated time: follow the lab README; execution time varies by agent and sandbox environment
Common requirements:
Some advanced labs additionally require tools such as kubectl, kind, helm, cosign, syft, grype, jq, Python, an OpenAI API key, or Docker Sandboxes. Always check the selected lab's README before starting.
git clone https://github.com/opscart/docker-security-practical-guide.git
cd docker-security-practical-guide
cd labs/01-docker-bench-security
cat README.md
./run-audit.sh
Start with Labs 01–06, then continue according to your goals. Each lab remains self-contained, so you can pause or skip topics that are not relevant to your environment.
Select labs by threat model:
Use Lab 01 for baseline checks, Labs 03 and 07 for vulnerability and SBOM evidence, Lab 09 for runtime-risk review, Lab 10 for secrets evidence, and Lab 12 for admission and trust-governance controls.
Focus on reusable scripts, CI/CD examples, policies, runtime controls, and migration patterns. Adapt them to your platform only after reviewing each lab's assumptions and safety notes.
Each lab is self-contained and may include:
README.mdcd labs/XX-lab-name
cat README.md
# Run only the commands documented by that lab.
# Cleanup commands also vary by lab.
Foundations
Labs 01–06
|
+--> Supply chain and network security: Labs 07–08
|
+--> Runtime escape and defense: Lab 09
|
+--> Production security and remediation: Labs 10–11
|
+--> Container trust governance: Lab 12
|
+--> AI context security: Lab 13
Estimated total: approximately 14–17 hours, excluding optional extensions, environment setup, repeated experiments, and agent-dependent Lab 13 testing.
Docker Bench Security, Trivy, Syft, Grype, Cosign, OPA, Kyverno, Falco, Vault, GitLeaks, OpenSSL, Docker Scout, kind, Kubernetes, Redis, Flask, AutoGen, Claude Code, Gemini CLI, and Docker Sandboxes.
Docker Engine, Docker Compose, Linux capabilities, seccomp, user namespaces, read-only filesystems, Docker networking, TLS, CI/CD security gates, SBOMs, provenance, admission control, secrets management, AI tool isolation, and context-poisoning defense.
See Lab 08 architecture diagrams for multi-tier segmentation and encrypted communication patterns.
See Lab 12 architecture for the Supply Chain → Trust → Enforcement control loop, and Lab 07 for SBOM workflows.
Contributions are welcome:
Detailed external references are maintained in docs/additional-resources.md.
Start with docs/troubleshooting.md, then use the selected lab's README or lab-local troubleshooting guide.
docker version
docker compose version
For script permission errors:
chmod +x script-name.sh
Do not use generic cleanup commands across all labs. Use the cleanup procedure documented by the selected lab.
Docker Sandboxes is evolving rapidly. To keep this repository focused on core Docker security while allowing rapid experimentation, advanced Docker Sandbox content is maintained in a dedicated companion repository.
Topics include:
Repository:
https://github.com/opscart/docker-sandbox-devops
MIT License. See LICENSE.
Thanks to the Docker, CIS, OWASP, Anchore, Sigstore, CNCF, and broader open-source security communities whose tools, standards, and documentation support these labs.
Star the repository, share a lab with your team, report reproducibility issues, or contribute a focused improvement.
Watch the repository and follow @opscart for updates.
17 commits
Shell
83.9%
Python
13.4%
Dockerfile
2.1%
A hands-on lab toolkit for container security, from CIS-benchmark fundamentals to architectural trust governance. 12 production-grade labs covering image hardening, signing, supply chain attestation, admission control, and runtime debugging. Designed around reproducible, production-oriented container security scenarios.
43
stars
17
commits
Shell
primary language
Aug 1, 2026
updated
A hands-on Docker and container security guide built around reproducible labs, attack scenarios, defensive controls, and production-oriented validation.
The repository progresses from foundational Docker hardening to runtime escape analysis, secrets management, software supply-chain trust, AI-assisted remediation, and AI context-poisoning defenses.
/proc or /sys exposureThis guide is part of OpsCart Labs, a collection of open-source, hands-on labs informed by production cloud and Kubernetes operations.
Docker Security: A Practical Guide — this repository
Certified Kubernetes Administrator Exam Prep
Use this section as the central entry point for the repository.
| Area | Purpose |
|---|---|
| Lab Catalog | Select a hands-on lab by security domain or learning level |
| Publications and Research | Connect formal research, CNCF publications, practitioner articles, and implementation evidence |
| Additional Resources | Browse official documentation, standards, security tools, and primary research |
| Setup Guide | Prepare Docker, shared tooling, and the common lab environment |
| Troubleshooting Guide | Diagnose shared Docker, Compose, networking, tooling, and Kubernetes problems |
| Repository Issues | Report broken links, reproducibility problems, or documentation corrections |
Some topics evolve independently of this repository or require deeper experimentation than fits within the Docker Security Guide. These companion repositories provide verified implementations, extended experiments, and specialized documentation.
| Project | Description |
|---|---|
| Docker Sandbox DevOps | Dedicated companion repository for Docker Sandboxes, AI coding-agent isolation, Kubernetes debugging, and DevOps toolkit experiments. |
Each lab has its own README with prerequisites, detailed steps, validation, expected results, and cleanup instructions. The root README intentionally provides a concise catalog so lab-specific documentation remains the source of truth.
Run Docker Bench Security, interpret CIS-aligned findings, identify dangerous configurations, and review practical remediations.
Estimated time: 30–45 minutes
Compare insecure and hardened configurations using capability controls, read-only filesystems, tmpfs, non-root execution, and no-new-privileges.
Estimated time: 45–60 minutes
Scan images with Trivy, generate SBOMs with Syft, analyze them with Grype, and enforce vulnerability policy with OPA.
Estimated time: 60–90 minutes
Sign and verify images with Cosign, examine content trust, manage signing keys, and enforce image-signing policy.
Estimated time: 45–60 minutes
Understand Linux syscalls, examine Docker's default seccomp behavior, generate restrictive profiles, and validate them without breaking workloads.
Estimated time: 90–120 minutes
Harden containerized ML inference with resource controls, input validation, monitoring, and Kubernetes security settings.
Estimated time: 60–90 minutes
Generate and compare SBOMs, scan them for vulnerabilities, and integrate supply-chain checks into GitHub Actions and Azure Pipelines.
Estimated time: 45–60 minutes
Practice network isolation, multi-tier segmentation, internal networks, TLS encryption, and common network-misconfiguration remediation.
Estimated time: 18–22 minutes
Explore Docker socket escape, privileged containers, CAP_SYS_ADMIN, host mounts, and /proc or /sys exposure, then apply Falco, Kyverno, and audit-script defenses.
Run offensive scenarios only in an isolated disposable environment. Do not use a production host.
Estimated time: 2–2.5 hours
Study secret leakage anti-patterns, Docker Swarm secrets, Vault integration, BuildKit secret mounts, repository scanning, and audit/compliance evidence.
Scenarios:
Estimated time: approximately 90 minutes
Build an AutoGen-based agent that uses GPT-3.5-turbo and a secured MCP server to inspect logs, restart containers, update resources, and escalate unsafe or uncertain remediation decisions.
The security pipeline includes HMAC authentication, Redis-backed rate limiting, input validation, audit logging, non-root execution, read-only filesystems, dropped capabilities, and resource limits.
Scenarios: OOM remediation, crash escalation, exit-code retry logic, and health-check recovery.
Estimated time: 60–90 minutes
Build a vendor-neutral trust-control architecture using hardened images, Kyverno admission policies, Cosign, SBOM and provenance attestations, phased enforcement, break-glass controls, and fleet drift analysis.
Experiments:
Estimated time: 90–120 minutes
Test zero-width Unicode instruction injection and malicious agent hooks against controlled projects, compare Claude Code and Gemini CLI behavior, and validate Docker Sandboxes as an infrastructure-level defense.
The lab documents two independent defenses:
Estimated time: follow the lab README; execution time varies by agent and sandbox environment
Common requirements:
Some advanced labs additionally require tools such as kubectl, kind, helm, cosign, syft, grype, jq, Python, an OpenAI API key, or Docker Sandboxes. Always check the selected lab's README before starting.
git clone https://github.com/opscart/docker-security-practical-guide.git
cd docker-security-practical-guide
cd labs/01-docker-bench-security
cat README.md
./run-audit.sh
Start with Labs 01–06, then continue according to your goals. Each lab remains self-contained, so you can pause or skip topics that are not relevant to your environment.
Select labs by threat model:
Use Lab 01 for baseline checks, Labs 03 and 07 for vulnerability and SBOM evidence, Lab 09 for runtime-risk review, Lab 10 for secrets evidence, and Lab 12 for admission and trust-governance controls.
Focus on reusable scripts, CI/CD examples, policies, runtime controls, and migration patterns. Adapt them to your platform only after reviewing each lab's assumptions and safety notes.
Each lab is self-contained and may include:
README.mdcd labs/XX-lab-name
cat README.md
# Run only the commands documented by that lab.
# Cleanup commands also vary by lab.
Foundations
Labs 01–06
|
+--> Supply chain and network security: Labs 07–08
|
+--> Runtime escape and defense: Lab 09
|
+--> Production security and remediation: Labs 10–11
|
+--> Container trust governance: Lab 12
|
+--> AI context security: Lab 13
Estimated total: approximately 14–17 hours, excluding optional extensions, environment setup, repeated experiments, and agent-dependent Lab 13 testing.
Docker Bench Security, Trivy, Syft, Grype, Cosign, OPA, Kyverno, Falco, Vault, GitLeaks, OpenSSL, Docker Scout, kind, Kubernetes, Redis, Flask, AutoGen, Claude Code, Gemini CLI, and Docker Sandboxes.
Docker Engine, Docker Compose, Linux capabilities, seccomp, user namespaces, read-only filesystems, Docker networking, TLS, CI/CD security gates, SBOMs, provenance, admission control, secrets management, AI tool isolation, and context-poisoning defense.
See Lab 08 architecture diagrams for multi-tier segmentation and encrypted communication patterns.
See Lab 12 architecture for the Supply Chain → Trust → Enforcement control loop, and Lab 07 for SBOM workflows.
Contributions are welcome:
Detailed external references are maintained in docs/additional-resources.md.
Start with docs/troubleshooting.md, then use the selected lab's README or lab-local troubleshooting guide.
docker version
docker compose version
For script permission errors:
chmod +x script-name.sh
Do not use generic cleanup commands across all labs. Use the cleanup procedure documented by the selected lab.
Docker Sandboxes is evolving rapidly. To keep this repository focused on core Docker security while allowing rapid experimentation, advanced Docker Sandbox content is maintained in a dedicated companion repository.
Topics include:
Repository:
https://github.com/opscart/docker-sandbox-devops
MIT License. See LICENSE.
Thanks to the Docker, CIS, OWASP, Anchore, Sigstore, CNCF, and broader open-source security communities whose tools, standards, and documentation support these labs.
Star the repository, share a lab with your team, report reproducibility issues, or contribute a focused improvement.
Watch the repository and follow @opscart for updates.
17 commits
Shell
83.9%
Python
13.4%
Dockerfile
2.1%