Docker Build
Build Docker images with proper tagging, cache busting, and build tracking.
by thelobbi · MIT
The skill
Build Docker images with proper tagging, cache busting, and build tracking. Prevents stale image issues.
Docker Build with Tracking
Build a Docker image with proper tagging and tracking: $ARGUMENTS
Process
-
Determine the image tag - Use git SHA or timestamp, NEVER use
:latestaloneGIT_SHA=$(git rev-parse --short HEAD) TIMESTAMP=$(date +%Y%m%d-%H%M%S) TAG="${GIT_SHA}-${TIMESTAMP}" -
Build with cache busting when needed
- For production builds:
docker build --no-cache --pull -t <registry>/<image>:${TAG} . - For dev builds:
docker build -t <registry>/<image>:${TAG} . - Always also tag as
:<branch>-latestfor convenience
- For production builds:
-
Verify the build
docker images | grep <image> docker inspect <registry>/<image>:${TAG} | jq '.[0].Created' -
Push to registry
docker push <registry>/<image>:${TAG} docker push <registry>/<image>:<branch>-latest -
Verify in registry
# For ACR: az acr repository show-tags --name <registry> --repository <image> --orderby time_desc --top 5 # For Docker Hub: docker manifest inspect <registry>/<image>:${TAG}
Anti-Patterns (DO NOT)
- Never build with just
:latesttag - Never skip pushing after building
- Never deploy without verifying the image exists in the registry
- Never use
imagePullPolicy: IfNotPresentwith mutable tags
Use this skill
Connect your agent to the Skill Store MCP server and ask for it by ref: thelobbi/docker-build-19066565222.
Details
- Publisher
- thelobbi
- Category
- Software Development › DevOps & cloud
- License
- MIT
- Updated
- 2026-10-08
References
More from thelobbi
- Agentic Design Patterns Catalog of 21 agentic AI design patterns (prompt chaining, routing, parallelization, reflection, too
- Atlassianapi Atlassian API integration for Jira and Confluence automation.
- Authentication Authentication and authorization including JWT, OAuth2, OIDC, sessions, RBAC, and security analysis.
- Aws AWS cloud services including EC2, EKS, S3, Lambda, RDS, and IAM.