Skip to content
Back to skills

Docker Dev Environments

ASecurity

Docker build environments with MCP for AI agent control.

  • 2 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 10, 2026
ai-agentspythonrustshellbashdockergitfrontendbackenddevops

Works with

  • mcp

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 4 files and shows the line behind each finding

Scanned September 10, 2026

npx -y skills add LoopyLuci/Skills --skill docker-dev-environments --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Docker Dev Environments?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Docker Dev Environments
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/loopyluci-docker-dev-environments/badge)](https://www.skillsdirectory.com/skills/loopyluci-docker-dev-environments)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: docker-dev-environments
description: "Docker build environments with MCP for AI agent control."
tags: [docker, devops, mcp, build-environments, ai-agents]
---

# Docker Development Environments with MCP Integration

## When to Use This Skill

Building reproducible Docker development environments that include:
- Build toolchains (compilers, linkers, SDKs)
- MCP server for AI agent control of build/test/lint workflows
- docker-compose orchestration for multiple services
- Build/test/lint shell scripts that run inside containers

This skill covers the integration layer between Docker, MCP servers, and build systems — not Docker basics or MCP protocol internals (see `mcp-server` skill for MCP details).

## Architecture Pattern

```
┌─────────────────────────────────────────────────────┐
│  docker-compose.yml                                  │
│  ├── base (Dockerfile)                               │
│  │   ├── Build toolchain (Clang/MSVC, CMake, Ninja) │
│  │   ├── SDK (Vulkan, CUDA, etc.)                   │
│  │   ├── MCP server (Python/Rust)                   │
│  │   └── Build/test/lint scripts                    │
│  ├── build service → build.sh                       │
│  ├── test service  → test.sh                        │
│  ├── lint service  → lint.sh                        │
│  ├── ci service    → full pipeline                  │
│  ├── mcp service   → MCP server (long-running)      │
│  └── shell service → interactive bash               │
└─────────────────────────────────────────────────────┘
```

## Dockerfile Construction

### Single-stage pattern (recommended for dev environments)

```dockerfile
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential cmake ninja-build ccache \
    clang-17 clang++-17 clang-tools-17 \
    python3 python3-pip python3-venv \
    git curl jq

RUN python3 -m pip install --break-system-packages mcp
COPY docker/mcp_server.py /opt/mcp/server.py
COPY docker/docker-entrypoint.sh /opt/mcp/entrypoint.sh
COPY docker/build.sh /opt/scripts/build.sh
COPY docker/test.sh /opt/scripts/test.sh
COPY docker/lint.sh /opt/scripts/lint.sh
RUN chmod +x /opt/scripts/*.sh /opt/mcp/entrypoint.sh

ENV CC=clang-17 CXX=clang++-17
ENV PATH="/opt/scripts:${PATH}"
WORKDIR /workspace
ENTRYPOINT ["/opt/mcp/entrypoint.sh"]
```

### Key decisions

- **ccache**: Always include for rebuild speed. Set `CMAKE_C_COMPILER_LAUNCHER=ccache`.
- **compile_commands.json**: Generate in lint profile (`-DCMAKE_EXPORT_COMPILE_COMMANDS=ON`).
- **Entrypoint routing**: Dispatches based on first argument (`mcp`, `build`, `test`, `ci`, `shell`).

## docker-compose.yml Pattern

```yaml
services:
  base:
    build: { context: ., dockerfile: docker/Dockerfile }
    image: myproject:latest
    volumes: [".:/workspace"]
    environment: [CC=clang-17, CXX=clang++-17]

  build:
    extends: base
    entrypoint: ["/opt/scripts/build.sh"]
    profiles: ["build"]

  test:
    extends: base
    entrypoint: ["/opt/scripts/test.sh"]
    profiles: ["test"]

  mcp:
    extends: base
    entrypoint: ["python3", "/opt/mcp/server.py"]
    command: ["--stdio"]
    stdin_open: true
    ports: ["8080:8080"]
    profiles: ["mcp"]

  shell:
    extends: base
    entrypoint: ["bash"]
    stdin_open: true
    tty: true
    profiles: ["shell"]
```

## MCP Server Tool Set

| Tool | Purpose | Returns |
|------|---------|---------|
| `build` | CMake configure + compile | artifacts list |
| `test` | CTest runner with filter | pass/fail counts |
| `lint` | clang-tidy/format/cppcheck | per-linter results |
| `analyze` | Parse report.json | telemetry summary |
| `file_list` | List source files | paths + sizes |
| `file_read` | Read file with line numbers | paginated content |
| `syntax_check` | Single-file compile check | errors/warnings |
| `status` | Environment info | compiler versions |

## Entrypoint Dispatch

```bash
case "${1:-}" in
    mcp)   exec python3 /opt/mcp/server.py --stdio ;;
    build) /opt/scripts/build.sh; exit $? ;;
    test)  /opt/scripts/test.sh; exit $? ;;
    lint)  /opt/scripts/lint.sh "${@:2}"; exit $? ;;
    ci)    /opt/scripts/build.sh && /opt/scripts/test.sh && /opt/scripts/lint.sh ;;
    shell) exec bash ;;
    *)     exec "$@" ;;
esac
```

## Common Pitfalls

- **Docker daemon not running** — On Windows, Docker Desktop WSL2 backend may fail. Check with `docker info` before building. Fall back to local MSVC build.
- **Docker Desktop requires admin** — On Windows, installation needs elevated privileges. Use `winget install Docker.DockerDesktop` in an admin shell.
- **Entrypoint vs command** — `entrypoint` is the executable, `command` is its arguments. Don't put arguments in `entrypoint`.
- **Volume mount permissions** — Linux containers may see different UID/GID. Use `--user` flag or fix permissions in Dockerfile.
- **MCP stdio buffering** — Python's `sys.stdout` is line-buffered by default. Use `sys.stdout.flush()` after each JSON-RPC response.
- **compile_commands.json not generated** — Add `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` to CMake configure for lint tools to work.

## Verification

1. `docker compose run build` produces `build_*/` directory with binaries
2. `docker compose run test` shows pass/fail counts
3. `echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | docker compose run mcp` returns tool list
4. `docker compose run shell` gives interactive bash inside the container
5. All scripts pass `bash -n` syntax check
6. MCP server passes `python3 -c "import ast; ast.parse(open('mcp_server.py').read())"`

## Related References

- `references/docker-desktop-windows.md` — Installation and troubleshooting for Docker Desktop on Windows
- `references/docker-removal-windows.md` — Complete Docker removal guide for Windows (7-layer cleanup: engine, WSL2, registry, services, files, env vars, Windows features) with automated PowerShell tooling at `D:\Projects\DockerManager\`
- `references/python-mcp-server-pattern.md` — MCP server implementation patterns for Python

Files in this skill

  • SKILL.md6.3 KB
  • references/docker-desktop-windows.md2.1 KB
  • references/docker-removal-windows.md8.9 KB
  • references/python-mcp-server-pattern.md4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.