Claude-skill-registry docker-hub-toolkit
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/docker-hub-toolkit" ~/.claude/skills/majiayu000-claude-skill-registry-docker-hub-toolkit && rm -rf "$T"
manifest:
skills/data/docker-hub-toolkit/SKILL.mdsource content
Docker Hub Toolkit
End-to-end automation for deploying Python project images to Docker Hub with maximum performance and efficiency.
What This Skill Does
- Generates optimized multi-stage Dockerfiles (base → builder → dev → production)
- Builds, tags, and pushes images to Docker Hub
- Creates CI/CD pipelines (GitHub Actions) for automated deployment
- Optimizes image size and build speed with BuildKit caching
- Sets up multi-platform builds (amd64/arm64)
- Generates
and.dockerignoredocker-compose.yml - Scans images for security vulnerabilities
- Debugs failed Docker builds
What This Skill Does NOT Do
- Deploy to Kubernetes/ECS/cloud orchestrators (container runtime only)
- Manage Docker Hub billing or account settings
- Handle non-Python project images
- Create Docker Swarm or cluster configurations
- Manage Docker Hub webhooks or automated test integrations
Before Implementation
Gather context to ensure successful implementation:
| Source | Gather |
|---|---|
| Codebase | Python framework (FastAPI/Flask/Django), entry point, dependencies file |
| Conversation | Docker Hub username, image name, target platforms, version tag |
| Skill References | Multi-stage patterns, CI/CD templates, security practices from |
| User Guidelines | Team Docker standards, naming conventions, security requirements |
Ensure all required context is gathered before implementing. Only ask user for THEIR specific requirements (domain expertise is in this skill).
Required Clarifications
Ask about USER'S context:
- Docker Hub credentials: "What is your Docker Hub username/namespace?"
- Project type: "What Python framework? (FastAPI, Flask, Django, script)"
- Entry point: "What command starts your app? (e.g.,
)"uvicorn app.main:app - Deployment target: "Local push, or automated CI/CD via GitHub Actions?"
Workflow
Full Deployment Pipeline
1. Generate Dockerfile → Multi-stage optimized build 2. Create .dockerignore → Exclude unnecessary files 3. Build image → With BuildKit caching 4. Tag image → Semantic version + git SHA 5. Security scan → Check for vulnerabilities 6. Push to Docker Hub → Authenticated push 7. Set up CI/CD → GitHub Actions automation (optional)
Stage-by-Stage Execution
Stage 1: Generate Base Configuration
- Detect Python version from
,pyproject.toml
, orsetup.py.python-version - Identify dependency file (
,requirements.txt
,pyproject.toml
)Pipfile - Generate
from.dockerignoreassets/templates/dockerignore.template - Create multi-stage Dockerfile using patterns from
references/multi-stage-builds.md
Stage 2: Build Dependencies Stage
- Use
for pip caching--mount=type=cache,target=/root/.cache/pip - Use
for dependency files--mount=type=bind - Install to
for clean multi-stage copy--user - Verify dependency resolution succeeds
Stage 3: Development/Test Stage (Optional)
- Copy dependencies from builder
- Copy source code
- Run tests (
) and lintingpytest - Target with
docker build --target dev
Stage 4: Production Build & Push
- Fresh slim base image
- Create non-root user
- Copy only runtime dependencies from builder
- Set proper
/CMDENTRYPOINT - Tag with version strategy
- Push to Docker Hub
Available Scripts
| Script | Purpose | Usage |
|---|---|---|
| Build, tag, and push image | |
| Lint and validate Dockerfile | |
| Configure buildx for multi-arch | |
Dependencies
- Docker Engine 20.10+ (BuildKit support)
- Docker CLI with buildx plugin
- Docker Hub account with access token
- Git (for SHA-based tagging)
- Python 3.10+ (for the project being containerized)
Error Handling
| Error | Recovery |
|---|---|
| Build fails on pip install | Check requirements.txt syntax, verify package availability |
| Push denied/unauthorized | Run , verify access token |
| Image too large (>500MB) | Switch to slim base, verify multi-stage COPY |
| BuildKit not available | Set or use |
| Multi-platform fails | Run |
| Rate limit exceeded | Wait or use authenticated pulls |
See
references/troubleshooting.md for comprehensive error resolution.
Input/Output
- Input: Python project with dependency file (requirements.txt/pyproject.toml)
- Output: Optimized Docker image pushed to Docker Hub at
username/app:tag
Output Checklist
Before delivering, verify:
- Multi-stage Dockerfile with base → builder → production stages
-
excludes.dockerignore
,.git
,__pycache__
,.venv
,.envnode_modules - BuildKit cache mounts used for pip installs
- Non-root user in production stage
-
andPYTHONDONTWRITEBYTECODE=1
setPYTHONUNBUFFERED=1 - Image tagged with semantic version
- Image pushed successfully to Docker Hub
- Image size < 200MB (for typical Python apps)
- No secrets or credentials in image layers
- CI/CD pipeline configured (if requested)
Reference Files
| File | When to Read |
|---|---|
| Dockerfile patterns, stage architecture, anti-patterns |
| Push workflow, tagging strategy, Hub settings |
| GitHub Actions pipeline, caching, automation |
| Claude Code commands, hooks, CLAUDE.md standards |
| Build/push errors, size issues, security fixes |
| Original multi-stage build stages reference |
| Claude capabilities for Docker Hub |