docker.recipes

Argo CD GitOps

advanced

Declarative continuous delivery for Kubernetes with GitOps workflow.

Overview

Argo CD is a declarative GitOps continuous delivery tool that brings Git-driven deployment workflows to Kubernetes environments. Originally developed by Intuit and now a CNCF graduated project, Argo CD implements the GitOps methodology where Git repositories serve as the single source of truth for application configurations and deployment states. This approach revolutionizes how teams manage Kubernetes deployments by eliminating manual kubectl commands and configuration drift through automated synchronization between Git repositories and cluster states. This comprehensive stack combines Argo CD's core components with Redis for caching and Dex for identity management to create a production-grade GitOps platform. The argocd-server provides the web UI and API gateway, argocd-repo-server handles Git repository operations and manifest generation, while argocd-application-controller continuously monitors and reconciles application states. Redis serves as the distributed cache and session store, significantly improving performance for large-scale deployments, while Dex enables enterprise-grade authentication through OIDC, SAML, and other identity providers. This configuration is ideal for DevOps teams, platform engineers, and organizations seeking to implement mature GitOps practices without the complexity of manual Kubernetes installation. Unlike traditional CI/CD tools that push changes to environments, Argo CD pulls desired state from Git repositories, providing better security, auditability, and disaster recovery capabilities. The stack particularly excels in multi-cluster environments where centralized application lifecycle management and consistent deployment practices are critical for operational efficiency.

Key Features

  • Declarative GitOps workflow with Git repositories as the source of truth for all deployments
  • Real-time application health monitoring with detailed resource status and sync state visibility
  • Multi-cluster deployment management from a single Argo CD instance with cluster credential isolation
  • Automated drift detection and self-healing capabilities when cluster state deviates from Git
  • Pre-sync and post-sync hooks for database migrations, testing, and custom deployment logic
  • Role-based access control with project-level permissions and Git repository restrictions
  • Application rollback capabilities with Git history-based version management
  • SSO integration through Dex supporting OIDC, SAML, GitHub, GitLab, and enterprise identity providers

Common Use Cases

  • 1Multi-environment Kubernetes deployments with promotion pipelines from dev to staging to production
  • 2Microservices architecture deployment where multiple teams manage independent applications through Git
  • 3Infrastructure as Code management for Kubernetes resources including ingress controllers, monitoring, and security policies
  • 4Multi-cluster application deployment across different cloud providers or regions with consistent configurations
  • 5Disaster recovery scenarios where entire cluster states can be reconstructed from Git repository definitions
  • 6Compliance-driven environments requiring audit trails and approval workflows for production changes
  • 7Development team self-service platforms where developers deploy applications without direct cluster access

Prerequisites

  • Minimum 2GB RAM allocated to Docker (1GB for Argo CD components, 512MB for Redis, plus system overhead)
  • Access to Kubernetes cluster with kubectl configured (required for Argo CD to manage applications)
  • Git repository with Kubernetes manifests, Helm charts, or Kustomize configurations for applications
  • Port 8080 available for Argo CD web interface access
  • Basic understanding of Kubernetes concepts including deployments, services, and YAML manifests
  • Git repository access credentials and webhook configuration knowledge for automated sync triggers

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 argocd-server:
3 image: quay.io/argoproj/argocd:v2.9.3
4 container_name: argocd-server
5 command: argocd-server --staticassets /shared/app
6 environment:
7 - ARGOCD_SERVER_INSECURE=true
8 - REDIS_SERVER=redis:6379
9 volumes:
10 - argocd-data:/home/argocd
11 - ./repositories:/home/argocd/repo
12 ports:
13 - "8080:8080"
14 depends_on:
15 - redis
16 networks:
17 - argocd-network
18 restart: unless-stopped
19
20 argocd-repo-server:
21 image: quay.io/argoproj/argocd:v2.9.3
22 container_name: argocd-repo-server
23 command: argocd-repo-server --redis redis:6379
24 volumes:
25 - argocd-repo:/home/argocd
26 depends_on:
27 - redis
28 networks:
29 - argocd-network
30 restart: unless-stopped
31
32 argocd-application-controller:
33 image: quay.io/argoproj/argocd:v2.9.3
34 container_name: argocd-controller
35 command: argocd-application-controller --redis redis:6379 --repo-server argocd-repo-server:8081
36 volumes:
37 - argocd-controller:/home/argocd
38 depends_on:
39 - argocd-repo-server
40 networks:
41 - argocd-network
42 restart: unless-stopped
43
44 redis:
45 image: redis:7-alpine
46 container_name: argocd-redis
47 volumes:
48 - redis-data:/data
49 networks:
50 - argocd-network
51 restart: unless-stopped
52
53 dex:
54 image: ghcr.io/dexidp/dex:v2.37.0
55 container_name: argocd-dex
56 command: dex serve /etc/dex/config.yaml
57 volumes:
58 - ./dex-config.yaml:/etc/dex/config.yaml:ro
59 networks:
60 - argocd-network
61 restart: unless-stopped
62
63volumes:
64 argocd-data:
65 argocd-repo:
66 argocd-controller:
67 redis-data:
68
69networks:
70 argocd-network:
71 driver: bridge

.env Template

.env
1# Argo CD
2# Note: This is a simplified Docker Compose setup
3# For production, deploy to Kubernetes
4
5# Get initial admin password:
6# kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d

Usage Notes

  1. 1Web UI at http://localhost:8080
  2. 2Login: admin / (get from secret)
  3. 3GitOps continuous delivery
  4. 4Sync apps from Git repos
  5. 5Best run on Kubernetes

Individual Services(5 services)

Copy individual services to mix and match with your existing compose files.

argocd-server
argocd-server:
  image: quay.io/argoproj/argocd:v2.9.3
  container_name: argocd-server
  command: argocd-server --staticassets /shared/app
  environment:
    - ARGOCD_SERVER_INSECURE=true
    - REDIS_SERVER=redis:6379
  volumes:
    - argocd-data:/home/argocd
    - ./repositories:/home/argocd/repo
  ports:
    - "8080:8080"
  depends_on:
    - redis
  networks:
    - argocd-network
  restart: unless-stopped
argocd-repo-server
argocd-repo-server:
  image: quay.io/argoproj/argocd:v2.9.3
  container_name: argocd-repo-server
  command: argocd-repo-server --redis redis:6379
  volumes:
    - argocd-repo:/home/argocd
  depends_on:
    - redis
  networks:
    - argocd-network
  restart: unless-stopped
argocd-application-controller
argocd-application-controller:
  image: quay.io/argoproj/argocd:v2.9.3
  container_name: argocd-controller
  command: argocd-application-controller --redis redis:6379 --repo-server argocd-repo-server:8081
  volumes:
    - argocd-controller:/home/argocd
  depends_on:
    - argocd-repo-server
  networks:
    - argocd-network
  restart: unless-stopped
redis
redis:
  image: redis:7-alpine
  container_name: argocd-redis
  volumes:
    - redis-data:/data
  networks:
    - argocd-network
  restart: unless-stopped
dex
dex:
  image: ghcr.io/dexidp/dex:v2.37.0
  container_name: argocd-dex
  command: dex serve /etc/dex/config.yaml
  volumes:
    - ./dex-config.yaml:/etc/dex/config.yaml:ro
  networks:
    - argocd-network
  restart: unless-stopped

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 argocd-server:
5 image: quay.io/argoproj/argocd:v2.9.3
6 container_name: argocd-server
7 command: argocd-server --staticassets /shared/app
8 environment:
9 - ARGOCD_SERVER_INSECURE=true
10 - REDIS_SERVER=redis:6379
11 volumes:
12 - argocd-data:/home/argocd
13 - ./repositories:/home/argocd/repo
14 ports:
15 - "8080:8080"
16 depends_on:
17 - redis
18 networks:
19 - argocd-network
20 restart: unless-stopped
21
22 argocd-repo-server:
23 image: quay.io/argoproj/argocd:v2.9.3
24 container_name: argocd-repo-server
25 command: argocd-repo-server --redis redis:6379
26 volumes:
27 - argocd-repo:/home/argocd
28 depends_on:
29 - redis
30 networks:
31 - argocd-network
32 restart: unless-stopped
33
34 argocd-application-controller:
35 image: quay.io/argoproj/argocd:v2.9.3
36 container_name: argocd-controller
37 command: argocd-application-controller --redis redis:6379 --repo-server argocd-repo-server:8081
38 volumes:
39 - argocd-controller:/home/argocd
40 depends_on:
41 - argocd-repo-server
42 networks:
43 - argocd-network
44 restart: unless-stopped
45
46 redis:
47 image: redis:7-alpine
48 container_name: argocd-redis
49 volumes:
50 - redis-data:/data
51 networks:
52 - argocd-network
53 restart: unless-stopped
54
55 dex:
56 image: ghcr.io/dexidp/dex:v2.37.0
57 container_name: argocd-dex
58 command: dex serve /etc/dex/config.yaml
59 volumes:
60 - ./dex-config.yaml:/etc/dex/config.yaml:ro
61 networks:
62 - argocd-network
63 restart: unless-stopped
64
65volumes:
66 argocd-data:
67 argocd-repo:
68 argocd-controller:
69 redis-data:
70
71networks:
72 argocd-network:
73 driver: bridge
74EOF
75
76# 2. Create the .env file
77cat > .env << 'EOF'
78# Argo CD
79# Note: This is a simplified Docker Compose setup
80# For production, deploy to Kubernetes
81
82# Get initial admin password:
83# kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
84EOF
85
86# 3. Start the services
87docker compose up -d
88
89# 4. View logs
90docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/argo-cd-gitops/run | bash

Troubleshooting

  • Application stuck in 'Unknown' health status: Check that Kubernetes cluster is accessible and kubectl context is properly configured in the cluster settings
  • ComparisonError with 'unable to load data from /tmp/...' messages: Repository server cannot access Git repository, verify SSH keys or HTTPS credentials in repository configuration
  • OutOfSync status despite no visible differences: Enable 'IgnoreExtraneous' resource option or check for resources created outside of Argo CD management
  • Redis connection timeouts causing slow UI performance: Increase Redis memory allocation or check network connectivity between Argo CD components and Redis container
  • Dex authentication failing with OIDC providers: Verify redirect URIs include http://localhost:8080/auth/callback in your identity provider configuration
  • 'permission denied' errors during sync operations: Check that Argo CD service account has appropriate RBAC permissions in the target Kubernetes namespace

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Components

argocd-serverargocd-repo-serverargocd-controllerredisdex

Tags

#gitops#kubernetes#argocd#cd#deployment

Category

DevOps & CI/CD
Ad Space