Containerize a CEDA app the house way — a uv-based Python image, non-root runtime user, pinned apt packages, and a docker-compose for local dev. Use when adding or editing a Dockerfile / docker-compose.yml in a CEDA repo, or debugging a container build.
Intro in this page language first. The official description stays in its original wording; we do not rewrite SKILL.md.
What it does
Containerize a CEDA app the house way — a uv-based Python image, non-root runtime user, pinned apt packages, and a docker-compose for local dev
When to use it
adding or editing a Dockerfile / docker-compose.yml in a CEDA repo, or debugging a container build
How agents load it
Per Agent Skills progressive disclosure: name and description load at startup (~100 tokens); the full SKILL.md body loads when the skill activates; scripts/, references/, and assets/ load only as needed. This file's sections: docker; When this applies; Image conventions; Best practices (from docs/gitlab.md); Lint before committing; docker-compose (local dev).
File analysis
File analysis: instruction-only skill (SKILL.md). The agent loads the full body when activated.
dockerWhen this appliesImage conventionsBest practices (from docs/gitlab.md)Lint before committingdocker-compose (local dev)Important
Containerize a CEDA app the house way — a uv-based Python image, non-root runtime user, pinned apt packages, and a docker-compose for local dev. Use when adding or editing a Dockerfile / docker-compose.yml in a CEDA repo, or debugging a container build.
DiscoverThe client exposes names and descriptions to the agent.
ActivateYour request or the task context selects the skill and loads its instructions.
Load resourcesReferenced scripts, documentation and assets are used when needed.
Choose the target agent and installation scope, keep referenced package files, then verify the skill appears in the client's catalog.
Ask your Agent to install
Copy these instructions to a compatible agent and confirm the target directory matches your client.
Install the agent skill "docker" into my project. The full SKILL.md and official description are at https://zicq.com/en/skills/skl-2898f6baec16632a-Docker.html
Save it as .cursor/skills/docker/SKILL.md or .claude/skills/docker/SKILL.md and keep the frontmatter name and description exactly as-is.
The CLI lets you choose the agent interactively. The default scope is the project; use -g for user scope. Confirm package availability with the discovery command, then use npx skills list to inspect installed skills.
---
name: docker
description: Containerize a CEDA app the house way — a uv-based Python image, non-root runtime user, pinned apt packages, and a docker-compose for local dev. Use when adding or editing a Dockerfile / docker-compose.yml in a CEDA repo, or debugging a container build.
---
# docker
CEDA repos ship a Dockerfile + docker-compose per repo. Match the existing
conventions (grounded in the GitLab `text-analysis` repo's `Dockerfile` and its
`docs/gitlab.md`); read the target repo's current Dockerfile first.
## When this applies
This is a **knowledge skill** — it loads (explicitly via `/docker`, or
automatically) when you add or edit a `Dockerfile` / `docker-compose.yml`, or
debug a container build in a CEDA repo. It is reference/convention.
## Image conventions
- **Base:** `python:3.12-slim` (multi-arch: `FROM --platform=${BUILDPLATFORM} ...`).
- **Security updates:** `apt-get update && apt-get -y upgrade`, install only what's
needed with `--no-install-recommends`, and **pin apt package versions**
(`cron=3.0pl1-162`, …). End the layer with `rm -rf /var/lib/apt/lists/*`.
- **uv for deps:** copy `pyproject.toml` + `uv.lock`, then `uv sync --frozen --no-dev`.
(Older repos `pip install -r requirements.txt`; match what the repo uses.)
- **Non-root runtime.** Create a user (`useradd -m streamlit`), `chown` what it
needs, `USER ` before the app runs. Never run the service as root.
- **Entrypoint** for Streamlit apps: `CMD ["uv", "run", "streamlit", "run", "src/main.py"]`.
## Best practices (from docs/gitlab.md)
1. Multi-stage builds to shrink the image where it helps.
2. Combine related `RUN` commands to reduce layers.
3. Specific version tags on the base image (not `latest`).
4. Remove build-only deps after use.
5. Non-root user (see above).
6. Include a healthcheck (compose or Dockerfile) — Streamlit apps expose `/healthz`.
## Lint before committing
```bash
hadolint Dockerfile
```
## docker-compose (local dev)
- Env comes from a **`.env`** file (gitignored); compose references
`${VAR}` (e.g. `MINIO_*`, `SURFDRIVE_*` — see /surfdrive).
- Bind-mount `src/` for live editing during dev.
- Common commands:
```bash
docker compose build
docker compose up # -d for detached
docker compose down # -v to drop volumes
docker exec -ti bash # shell in; -u root for maintenance
```
## Important
- **Match the repo's existing Dockerfile** (uv vs pip, base image) rather than
imposing a different toolchain.
- **Run the service as a non-root user** and pin apt package versions.
- A local `docker compose up` validates the image builds and starts — it does NOT
prove deployed behavior on SDP (that's Flux/GitLab CI; see /surf-sdp-helm-flux).
Verify the container actually serves before calling it done.
- Applies to cedanl repos.