docker-dsl
  • Getting Started
  • Guide
  • Reference
  • Changelog

Skills

A skill is a package of structured files that teaches an AI coding agent how to work with a specific tool or framework. The skill below was generated by Great Docs from this project’s documentation. Install it in your agent and it will be able to run commands, edit configuration, write content, and troubleshoot problems without step-by-step guidance from you.

Any agent — install with npx:

npx skills add https://yasyf.github.io/docker-dsl/

Codex / OpenCode

Tell the agent:
Fetch the skill file at https://yasyf.github.io/docker-dsl/skill.md and follow the instructions.

Manual — download the skill file:

curl -O https://yasyf.github.io/docker-dsl/skill.md

Or browse the SKILL.md file.

SKILL.md

---
name: docker-dsl
description: >
  Imperative context-manager DSL for authoring multi-stage Dockerfiles. Use when writing Python code that uses the docker_dsl package.
license: MIT
compatibility: Requires Python >=3.13.
---

# docker-dsl

Imperative context-manager DSL for authoring multi-stage Dockerfiles.

## Installation

```bash
pip install docker-dsl
```

## API overview

### Entry points

Declare config and render a recipe into a Dockerfile.

- `Dockerfile`: Renders a recipe module into Dockerfile text
- `BuildContext`: Recipe-facing handle for config fields, exported as `context`
- `rendering`: Report whether a render pass is in progress

### Stage authoring

Declare stages and emit instructions.

- `Stage`: A build stage — one `FROM` and the instructions that follow it
- `MountScope`: A `with` block that applies a mount to the `RUN` commands inside it
- `EnvScope`: A `with` block that confines env variables to the `RUN` commands inside

### The run builder

Accumulate shell commands into one RUN instruction.

- `RunBuilder`: Accumulates shell commands into a single `RUN` instruction
- `AptMixin`: AptMixin(*, apt_updated: 'bool' = False, apt_dirty: 'bool' = True)
- `RedirectableCmd`: A pending `echo` awaiting a redirect target
- `CdScope`: A `cd` that optionally restores the previous directory
- `CmdInvoker`: A bound shell binary, produced by `RunBuilder`'s attribute dispatch

### Introspection

Query the active build during a render pass.

- `current_stage`: Return the stage of the innermost open `with Stage(...)` block

## Resources

- [Full documentation](https://yasyf.github.io/docker-dsl/)
- [llms.txt](llms.txt) — Indexed API reference for LLMs
- [llms-full.txt](llms-full.txt) — Comprehensive documentation for LLMs
- [Source code](https://github.com/yasyf/docker-dsl)

Developed by Yasyf Mohamedali.
Site created with Great Docs.