Skip to content

Instantly share code, notes, and snippets.

@ohmydevops
Created May 11, 2021 10:09
Show Gist options
  • Select an option

  • Save ohmydevops/358c34017ece624a11a8181d6bb4dcb5 to your computer and use it in GitHub Desktop.

Select an option

Save ohmydevops/358c34017ece624a11a8181d6bb4dcb5 to your computer and use it in GitHub Desktop.

Revisions

  1. Amirhossein Baghaie revised this gist May 11, 2021. No changes.
  2. Amirhossein Baghaie created this gist May 11, 2021.
    46 changes: 46 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    version: '3.8'

    services:
    registry:
    restart: always
    image: registry:2.7.1
    container_name: registry
    environment:
    REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
    REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
    REGISTRY_AUTH: htpasswd
    REGISTRY_STORAGE_DELETE_ENABLED: "true"
    LETSENCRYPT_HOST: YOUR_REGISTRY_URL (example: registry.example.com)
    VIRTUAL_HOST: YOUR_REGISTRY_URL (example: registry.example.com)
    VIRTUAL_PORT: 5000
    volumes:
    - ./registry_data:/var/lib/registry
    - ./auth:/auth

    nginx-proxy:
    restart: always
    image: nginxproxy/nginx-proxy
    container_name: nginx-proxy
    ports:
    - 0.0.0.0:80:80
    - 0.0.0.0:443:443
    volumes:
    - ./nginx-proxy/certs:/etc/nginx/certs
    - ./nginx-proxy/vhost.d:/etc/nginx/vhost.d
    - ./nginx-proxy/html:/usr/share/nginx/html
    - ./nginx-proxy/configs/default:/etc/nginx/vhost.d/default
    - /var/run/docker.sock:/tmp/docker.sock:ro

    nginx-proxy-acme:
    restart: always
    image: nginxproxy/acme-companion
    container_name: nginx-proxy-acme
    volumes:
    - ./nginx-acme/acme:/etc/acme.sh
    - /var/run/docker.sock:/var/run/docker.sock:ro
    - ./nginx-proxy/certs:/etc/nginx/certs
    - ./nginx-proxy/vhost.d:/etc/nginx/vhost.d
    - ./nginx-proxy/html:/usr/share/nginx/html
    environment:
    DEFAULT_EMAIL: YOUR_EMAIL
    NGINX_PROXY_CONTAINER: nginx-proxy