
Docker Ci Cd
- 54 installs
- 2 repo stars
- Updated January 5, 2026
- pluginagentmarketplace/custom-plugin-docker
Stand up a GitHub Actions pipeline that builds multi-arch Docker images, scans them, and pushes to GHCR on merge or tag.
About
docker-ci-cd is a ready-made GitHub Actions workflow for solo and indie builders who ship containerized apps. It wires checkout, QEMU, Docker Buildx, GHCR login with GITHUB_TOKEN, semantic and SHA tagging, and conditional push so pull requests only build while main, develop, and version tags publish images. The template fits SaaS APIs, CLIs, and agent backends that need consistent images without hand-rolling CI on every repo. Install it when you are moving from local docker build to automated registry delivery and want scan hooks and package write permissions aligned with GitHub’s container registry defaults.
- Complete GitHub Actions workflow for build, test, scan, and push to ghcr.io
- Multi-platform builds via QEMU and Buildx (linux/amd64 and linux/arm64)
- Branch, PR, tag, and SHA metadata tagging with docker/metadata-action
- PR builds without push; main/develop and v* tags trigger registry publish
- Uses official checkout, login, build-push, and Trivy-style security-events permissions pattern
Docker Ci Cd by the numbers
- 54 all-time installs (skills.sh)
- Ranked #691 of 1,453 DevOps & CI/CD skills by installs in the Skillselion catalog
- Security screen: MEDIUM risk (skills.sh audit)
- Data as of Jul 26, 2026 (Skillselion catalog sync)
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-docker --skill docker-ci-cdAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 54 |
|---|---|
| repo stars | ★ 2 |
| Security audit | 1 / 3 scanners passed |
| Last updated | January 5, 2026 |
| Repository | pluginagentmarketplace/custom-plugin-docker ↗ |
What it does
Stand up a GitHub Actions pipeline that builds multi-arch Docker images, scans them, and pushes to GHCR on merge or tag.
Files
Docker CI/CD Skill
Integrate Docker with CI/CD pipelines for automated image builds, security scanning, and deployments.
Purpose
Set up automated Docker workflows with GitHub Actions, GitLab CI, and other CI/CD platforms.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| platform | enum | No | github | github/gitlab/jenkins |
| registry | string | No | ghcr.io | Container registry |
| scan | boolean | No | true | Include security scan |
GitHub Actions
Complete Workflow
name: Docker Build and Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha
type=ref,event=branch
type=semver,pattern={{version}}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Scan for vulnerabilities
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ github.sha }}
exit-code: '1'
severity: 'CRITICAL,HIGH'Multi-Arch Build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build multi-arch
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}GitLab CI
# .gitlab-ci.yml
stages:
- build
- scan
- deploy
variables:
DOCKER_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
build:
stage: build
image: docker:24
services:
- docker:24-dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $DOCKER_IMAGE .
- docker push $DOCKER_IMAGE
scan:
stage: scan
image:
name: aquasec/trivy
entrypoint: [""]
script:
- trivy image --exit-code 1 --severity CRITICAL $DOCKER_IMAGE
deploy:
stage: deploy
script:
- ssh deploy@server "docker pull $DOCKER_IMAGE && docker compose up -d"
only:
- mainBest Practices
Caching
# GitHub Actions BuildKit cache
cache-from: type=gha
cache-to: type=gha,mode=max
# GitLab cache
cache:
key: docker-$CI_COMMIT_REF_SLUG
paths:
- .docker-cacheSecurity
# Scan before push
- name: Scan
run: trivy image --exit-code 1 --severity CRITICAL $IMAGE
# Sign images (cosign)
- name: Sign
run: cosign sign $IMAGEError Handling
Common Errors
| Error | Cause | Solution |
|---|---|---|
unauthorized | Bad credentials | Check registry login |
rate limit | Docker Hub limits | Use authenticated pulls |
cache miss | First build | Cache will populate |
Fallback Strategy
1. Build without cache if cache corrupted 2. Use fallback registry if primary down 3. Deploy previous version on failure
Troubleshooting
Debug Checklist
- [ ] Registry credentials valid?
- [ ] Docker daemon running?
- [ ] Build context correct?
- [ ] Dockerfile present?
Usage
Skill("docker-ci-cd")Assets
assets/github-actions-docker.yaml- GitHub Actions templatescripts/build-and-push.sh- Build script
Related Skills
- docker-production
- docker-security
# GitHub Actions Docker Workflow
# Builds, tests, scans, and pushes Docker images
name: Docker Build and Push
on:
push:
branches: [main, develop]
tags: ['v*']
pull_request:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
format: 'sarif'
output: 'trivy-results.sarif'
- name: Upload Trivy scan results
uses: github/codeql-action/upload-sarif@v2
if: always()
with:
sarif_file: 'trivy-results.sarif'
test:
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run container tests
run: |
docker run --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \
/bin/sh -c "echo 'Container health check passed'"
deploy:
runs-on: ubuntu-latest
needs: [build, test]
if: github.ref == 'refs/heads/main'
environment: production
steps:
- name: Deploy to production
run: |
echo "Deploying ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
# Add your deployment commands here
Docker CI/CD Integration Guide
GitHub Actions
Basic Build and Push
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: user/app:latestMulti-Platform Build
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64Cache Configuration
cache-from: type=gha
cache-to: type=gha,mode=maxGitLab CI
Basic Pipeline
build:
image: docker:24
services:
- docker:dind
script:
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHASecurity Scanning
Trivy Integration
- name: Trivy scan
uses: aquasecurity/trivy-action@master
with:
image-ref: myapp:latest
format: sarifSnyk Integration
- name: Snyk Container
uses: snyk/actions/docker@master
with:
image: myapp:latestBest Practices
1. Use semantic versioning for image tags 2. Scan all images before pushing 3. Cache layers for faster builds 4. Multi-arch support for ARM compatibility 5. Sign images for supply chain security 6. Automate everything possible
Environment Variables
# Common CI/CD variables
DOCKER_BUILDKIT=1
DOCKER_CLI_EXPERIMENTAL=enabled
COMPOSE_DOCKER_CLI_BUILD=1#!/bin/bash
# Docker Build and Push Script for CI/CD
# Usage: ./build-and-push.sh <image-name> <tag> [registry]
set -e
IMAGE_NAME=${1:-}
TAG=${2:-latest}
REGISTRY=${3:-ghcr.io}
PUSH=${PUSH:-false}
if [ -z "$IMAGE_NAME" ]; then
echo "Usage: $0 <image-name> [tag] [registry]"
echo "Example: $0 myorg/myapp v1.0.0 ghcr.io"
exit 1
fi
FULL_IMAGE="$REGISTRY/$IMAGE_NAME:$TAG"
echo "=========================================="
echo "Docker Build and Push"
echo "=========================================="
echo "Image: $FULL_IMAGE"
echo "Push: $PUSH"
echo "=========================================="
# Build with cache
echo ""
echo "Building image..."
docker build \
--cache-from "$REGISTRY/$IMAGE_NAME:latest" \
--build-arg BUILDKIT_INLINE_CACHE=1 \
-t "$FULL_IMAGE" \
-t "$REGISTRY/$IMAGE_NAME:latest" \
.
# Run tests
echo ""
echo "Running container tests..."
docker run --rm "$FULL_IMAGE" /bin/sh -c "echo 'Health check passed'" || {
echo "ERROR: Container test failed"
exit 1
}
# Scan for vulnerabilities
echo ""
echo "Scanning for vulnerabilities..."
if command -v trivy &> /dev/null; then
trivy image --severity HIGH,CRITICAL "$FULL_IMAGE"
else
echo "Trivy not installed, skipping scan"
fi
# Push if enabled
if [ "$PUSH" = "true" ]; then
echo ""
echo "Pushing image..."
docker push "$FULL_IMAGE"
docker push "$REGISTRY/$IMAGE_NAME:latest"
echo ""
echo "Successfully pushed: $FULL_IMAGE"
else
echo ""
echo "Build complete. Set PUSH=true to push image."
fi
echo ""
echo "=========================================="
echo "Done!"
echo "=========================================="
Related skills
FAQ
Is Docker Ci Cd safe to install?
skills.sh reports 1 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.