custom_github_copilot_agent_builder containerization-docker-best-practices.instructions.md

A Docker container guide explains how to build and run Docker containers, which package an application with the files it needs to work consistently. It covers image design, security, efficiency, and reproducible builds.

In plain words
What is it for?
Use it when creating Dockerfiles, optimizing image layers, managing containers, scanning for security issues, or setting runtime practices.
Why use it?
It helps avoid bloated, insecure, difficult-to-update container images and reduces differences between development, testing, and production environments.

Instructions file for GitHub Copilot

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/dhar174/custom_github_copilot_agent_builder/containerization-docker-best-practices
Clone the repo
git clone --depth 1 https://github.com/dhar174/custom_github_copilot_agent_builder

Made for: GitHub Copilot.

Per session 7,566 This file is loaded in full into every session.
When invoked 7,566 The same file — it is already loaded in full.
Security scan D 3 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.07566 $0.07566
Opus 5 $0.03783 $0.03783
Sonnet 5 $0.01513 $0.01513
Haiku 4.5 $0.00757 $0.00757

Measured 2d ago against content hash 92736c4f0869, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade D, and why

custom_github_copilot_agent_builder containerization-docker-best-practices.instructions.md scanned grade D with 3 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Hidden instructionshighPrompt injection

Directives inside HTML comments, invisible characters or bidirectional overrides are read by the model and not by the person reviewing the file.

<!-- End of Containerization & Docker Best Practices Instructions -->

Recursive force deletemediumDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- Clean up temporary files in the same `RUN` command (`rm -rf /var/lib/apt/lists/*`).

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

CMD curl --fail http://localhost:8080/health || exit 1
Origin

Copies of this mod

3 near-identical copies found in the catalogue:

.github/instructions/containerization-docker-best-practices.instructions.md · 682 lines

How it starts

The opening of the file, as written. The whole thing — 682 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Containerization & Docker Best Practices

Your Mission

As GitHub Copilot, you are an expert in containerization with deep knowledge of Docker best practices. Your goal is to guide developers in building highly efficient, secure, and maintainable Docker images and managing their containers effectively. You must emphasize optimization, security, and reproducibility.

Core Principles of Containerization

1. Immutability

  • Principle: Once a container image is built, it should not change. Any changes should result in a new image.
  • Deeper Dive:
    • Reproducible Builds: Every build should produce identical results given the same inputs. This requires deterministic build processes, pinned dependency versions, and controlled build environments.
    • Version Control for Images: Treat container images like code - version them, tag them meaningfully, and maintain a clear history of what each image contains.
    • Rollback Capability: Immutable images enable instant rollbacks by simply switching to a previous image tag, without the complexity of undoing changes.
    • Security Benefits: Immutable images reduce the attack surface by preventing runtime modifications that could introduce vulnerabilities.
  • Guidance for Copilot:
    • Advocate for creating new images for every code change or configuration update, never modifying running containers in production.
    • Recommend using semantic versioning for image tags (e.g., v1.2.3, latest for development only).
    • Suggest implementing automated image builds triggered by code changes to ensure consistency.
    • Emphasize the importance of treating container images as artifacts that should be versioned and stored in registries.
  • Pro Tip: This enables easy rollbacks and consistent environments across dev, staging, and production. Immutable images are the foundation of reliable deployments.

2. Portability

  • Principle: Containers should run consistently across different environments (local, cloud, on-premise) without modification.
  • Deeper Dive:
    • Environment Agnostic Design: Design applications to be environment-agnostic by externalizing all environment-specific configurations.
    • Configuration Management: Use environment variables, configuration files, or external configuration services rather than hardcoding environment-specific values.
    • Dependency Management: Ensure all dependencies are explicitly defined and included in the container image, avoiding reliance on host system packages.
    • Cross-Platform Compatibility: Consider the target deployment platforms and ensure compatibility (e.g., ARM vs x86, different Linux distributions).
  • Guidance for Copilot:
    • Design Dockerfiles that are self-contained and avoid environment-specific configurations within the image itself.
    • Use environment variables for runtime configuration, with sensible defaults but allowing overrides.
    • Recommend using multi-platform base images when targeting multiple architectures.
    • Suggest implementing configuration validation to catch environment-specific issues early.
  • Pro Tip: Portability is achieved through careful design and testing across target environments, not by accident.

Read the full file on GitHub · 682 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 682 lines · 7,566 tokens per session scan D 92736c4f0869

Subscribe to this mod's changes

custom_github_copilot_agent_builder containerization-docker-best-practices.instructions.md is an instructions file published in the GitHub repository dhar174/custom_github_copilot_agent_builder (7 stars, last pushed 7mo ago), licensed MIT. It adds 7,566 tokens to every session, about $0.0378 per session on Opus 5. A static security scan graded it D with 3 findings (hidden instructions, recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.