Docker

Guide Docker containerization across image building, networking, volumes, and security.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/zangxin75/openclaw-skills --skill docker-zangxin75
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Docker
Source: https://github.com/zangxin75/openclaw-skills/tree/main/docker
Command: npx skills add https://github.com/zangxin75/openclaw-skills --skill docker-zangxin75

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps users avoid common pitfalls and security vulnerabilities when building and running Docker containers, ensuring production stability and efficiency.

Core Features & Use Cases

  • Image Building Best Practices: Guides on layer caching, version pinning, and multi-stage builds.
  • Runtime Stability: Addresses issues like log driver limits, OOM killer, and root user execution.
  • Networking & Compose: Explains DNS resolution, port binding, and depends_on nuances.
  • Volume Management: Covers anonymous vs. named volumes and host permission issues.
  • Resource Management: Details on pruning dangling images, build cache, and stopped containers.
  • Security: Highlights risks of ENV/COPY for secrets, --privileged flag, and untrusted registries.
  • Debugging: Provides tips for exit codes, checking logs, and inspecting dead containers.

Quick Start

Use the docker skill to explain how to combine apt-get update and install in a single RUN layer.

Frequently Asked Questions about Docker

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I combine apt-get update and install in a single Dockerfile RUN layer?

Combine apt-get update and install in a single Dockerfile RUN layer to prevent caching issues where stale package lists cause failed installs. This ensures package lists remain synchronized with the packages being installed during image building.

Why does my Docker container keep getting killed by the OOM killer at runtime?

Docker containers get killed by the OOM killer when they exceed allocated memory limits. You can resolve runtime stability issues by configuring proper memory constraints and monitoring resource usage to prevent processes from consuming excessive host memory.

What is the difference between anonymous and named volumes in Docker Compose?

Named volumes are explicitly defined and managed by Docker, persisting across container recreations, while anonymous volumes are created automatically and often abandoned. Proper volume management prevents host permission issues and unintended data loss during container lifecycle changes.

How can I secure Docker secrets without exposing them in ENV or COPY instructions?

Avoid using ENV or COPY for Docker secrets to prevent security vulnerabilities. Instead, use runtime secret injection methods to ensure sensitive data is not persisted in image layers, mitigating risks of unauthorized access to credentials.

How do I debug a stopped Docker container and check its exit codes?

Debug stopped Docker containers by inspecting logs and checking exit codes to determine the failure cause. You can inspect dead containers to review their state and runtime history before removing them from the system.

What are the best practices for cleaning up dangling images and build cache in Docker?

Clean up dangling images and build cache using Docker pruning commands to manage disk resources. Regular pruning of stopped containers and stale build cache prevents disk bloat and maintains deployment efficiency across your environment.