CI/CD with Containers – A Modern Workflow
Continuous Integration and Continuous Delivery (CI/CD) have become the backbone of modern software development. When combined with containerization, they unlock unparalleled speed, consistency, and scalability. In this post we’ll explore how to set up a full CI/CD pipeline using Docker, GitHub Actions, and Kubernetes.

Why Containers?
Containers encapsulate an application with all its dependencies, ensuring that the code you test locally runs exactly the same in staging and production. This eliminates “works on my machine” bugs and speeds up onboarding.
Step‑by‑Step Pipeline
- Source Code – Push to a Git repository.
- Build – GitHub Actions builds a Docker image.
- Test – Run unit, integration, and security scans inside the container.
- Publish – Push the image to a container registry.
- Deploy – Use Kubernetes manifests to roll out the new version.
GitHub Actions Workflow
name: CI/CD Pipeline
on:
push:
branches: [ main ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Build and push image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ secrets.DOCKER_USER }}/cicd-demo:latest
- name: Deploy to Kubernetes
uses: azure/k8s-deploy@v4
with:
namespace: production
manifests: |
k8s/deployment.yaml
k8s/service.yaml
images: |
${{ secrets.DOCKER_USER }}/cicd-demo:latest
kubectl-version: 'v1.28.0'
Best Practices
- Store secrets securely (GitHub Secrets, Vault, etc.).
- Run static analysis and vulnerability scanning on the image.
- Implement blue‑green or canary deployments for zero‑downtime releases.
Conclusion
By marrying CI/CD with containers, you gain a repeatable, portable, and fast delivery mechanism. The example above shows a minimal yet powerful pipeline that can be extended with advanced testing, monitoring, and rollback strategies.
Comments
Share your thoughts below! (Feature coming soon.)