A Claude Code plugin providing comprehensive Dockerfile development support through:
- docker-langserver LSP integration for IDE-like features
- Automated hooks for linting with hadolint and best practices
- Dockerfile tool ecosystem integration (docker, hadolint)
# Run the setup command (after installing the plugin)
/setupOr manually:
# Install docker-langserver (LSP)
npm install -g dockerfile-language-server-nodejs
# Install hadolint (linter)
# macOS (Homebrew)
brew install hadolint
# Linux
wget -qO /usr/local/bin/hadolint https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64
chmod +x /usr/local/bin/hadolint
# Ensure Docker is installed
docker --versionThe plugin configures docker-langserver for Claude Code via .lsp.json:
{
"dockerfile": {
"command": "docker-langserver",
"args": ["--stdio"],
"extensionToLanguage": {
"Dockerfile": "dockerfile",
".dockerfile": "dockerfile"
},
"transport": "stdio"
}
}Capabilities:
- Go to definition for base images
- Hover documentation for instructions
- Code completion for Dockerfile instructions
- Real-time diagnostics
- Validation of instruction syntax
All hooks run afterWrite and are configured in hooks/hooks.json.
| Hook | Trigger | Tool Required | Description |
|---|---|---|---|
hadolint |
Dockerfile, *.dockerfile |
hadolint |
Best practices and security linting |
docker-build-check |
Dockerfile, *.dockerfile |
docker |
Syntax validation via Docker |
todo-fixme |
Dockerfile, *.dockerfile |
- | Surface TODO/FIXME/HACK/XXX/BUG comments |
Hook Features:
- Detects security issues (running as root, hardcoded secrets)
- Enforces best practices (layer caching, multi-stage builds)
- Validates instruction syntax
- Checks for deprecated instructions
- Suggests performance improvements
| Tool | Installation | Purpose |
|---|---|---|
docker-langserver |
npm install -g dockerfile-language-server-nodejs |
LSP server |
docker |
docker.com | Container runtime & syntax validation |
| Tool | Installation | Purpose |
|---|---|---|
hadolint |
brew install hadolint (macOS) |
Dockerfile linter |
Interactive setup wizard for configuring the complete Dockerfile development environment.
What it does:
- Verifies Docker installation - Checks
dockerCLI is available - Installs docker-langserver - LSP server for IDE features
- Installs hadolint - Dockerfile linter
- Validates LSP config - Confirms
.lsp.jsonis correct - Verifies hooks - Confirms hooks are properly loaded
Usage:
/setupdockerfile-lsp/
├── .claude-plugin/
│ └── plugin.json # Plugin metadata
├── .lsp.json # docker-langserver configuration
├── commands/
│ └── setup.md # /setup command
├── hooks/
│ ├── hooks.json # Hook definitions
│ └── scripts/
│ └── dockerfile-hooks.sh # Hook dispatcher
├── tests/
│ └── Dockerfile # Sample multi-stage Dockerfile
├── CLAUDE.md # Project instructions
└── README.md # This file
- Ensure Dockerfile exists in project
- Verify installation:
docker-langserver --version - Check LSP config:
cat .lsp.json - Ensure file is named
Dockerfileor has.dockerfileextension
- Verify installation:
hadolint --version - Run manually:
hadolint Dockerfile - Check for
.hadolint.yamlconfiguration conflicts
- Verify hooks are loaded:
cat hooks/hooks.json - Check file patterns match your structure
- Ensure tools are installed (
command -v hadolint)
- Ensure Docker daemon is running
- Check Dockerfile syntax with
docker build --check - Note:
docker build --checkrequires Docker 23.0+
Customize hadolint rules for your project:
# .hadolint.yaml
ignored:
- DL3006 # Always tag the version of an image explicitly
- DL3018 # Pin versions in apk add
trustedRegistries:
- docker.io
- gcr.io
override:
error:
- DL3001 # Ignore absolute WORKDIR
warning:
- DL3042 # Avoid cache busting with apt-getThe hooks enforce and suggest:
- Multi-stage builds for smaller images
- Layer caching optimization
- Version pinning for base images and packages
- Non-root user for security
- COPY instead of ADD unless needed
- Minimal layers by combining RUN commands
- .dockerignore for build context optimization
| Rule | Description | Severity |
|---|---|---|
| DL3000 | Use absolute WORKDIR | Warning |
| DL3002 | Don't switch to root USER | Warning |
| DL3008 | Pin versions in apt-get install | Warning |
| DL3009 | Delete apt-get lists after installing | Info |
| DL3015 | Avoid additional packages in yum install | Info |
| DL3025 | Use JSON notation for CMD and ENTRYPOINT | Warning |
| DL4006 | Use SHELL to change the default shell | Warning |
MIT