Last active
October 27, 2021 00:55
-
-
Save cweilguny/c1db2985b542f9916995139318e5a7ce to your computer and use it in GitHub Desktop.
A docker-compose config in v3 format for nginx-proxy with separate containers for nginx, dockergen and letsencrypt-companion. Additional example on how to get GitLab docker container running with this nginx-proxy setup. You need to create the docker network before, just run 'docker network create nginx-proxy'. Docker will tell you so if you don'…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
web: | |
image: 'gitlab/gitlab-ce:latest' | |
restart: always | |
hostname: 'gitlab.example.com' | |
environment: | |
GITLAB_OMNIBUS_CONFIG: | | |
external_url 'https://gitlab.example.com' | |
nginx['listen_port'] = 80 | |
nginx['listen_https'] = false | |
nginx['proxy_set_headers'] = { | |
"X-Forwarded-Proto" => "https", | |
"X-Forwarded-Ssl" => "on" | |
} | |
VIRTUAL_HOST: gitlab.example.com | |
LETSENCRYPT_HOST: gitlab.example.com | |
LETSENCRYPT_EMAIL: [email protected] | |
volumes: | |
- '/srv/dockerdata/gitlab/config:/etc/gitlab' | |
- '/srv/dockerdata/gitlab/logs:/var/log/gitlab' | |
- '/srv/dockerdata/gitlab/data:/var/opt/gitlab' | |
networks: | |
default: | |
external: | |
name: nginx-proxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
nginx: | |
image: nginx | |
container_name: nginx | |
ports: | |
- '80:80' | |
- '443:443' | |
volumes: | |
- 'nginx-config:/etc/nginx/conf.d' | |
- 'nginx-certs:/etc/nginx/certs' | |
- 'nginx-vhosts:/etc/nginx/vhost.d' | |
- 'nginx-webroot:/usr/share/nginx/html' | |
dockergen: | |
image: jwilder/docker-gen | |
container_name: nginx-docker-gen | |
command: -notify-sighup nginx -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf | |
volumes: | |
- 'nginx-config:/etc/nginx/conf.d' | |
- 'nginx-certs:/etc/nginx/certs' | |
- 'nginx-vhosts:/etc/nginx/vhost.d' | |
- 'nginx-webroot:/usr/share/nginx/html' | |
- '/var/run/docker.sock:/tmp/docker.sock:ro' | |
- './nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl' | |
letsencrypt: | |
image: jrcs/letsencrypt-nginx-proxy-companion | |
environment: | |
NGINX_DOCKER_GEN_CONTAINER: nginx-docker-gen | |
volumes: | |
- 'nginx-config:/etc/nginx/conf.d' | |
- 'nginx-certs:/etc/nginx/certs' | |
- 'nginx-vhosts:/etc/nginx/vhost.d' | |
- 'nginx-webroot:/usr/share/nginx/html' | |
- '/var/run/docker.sock:/var/run/docker.sock:ro' | |
volumes: | |
nginx-config: | |
nginx-certs: | |
nginx-vhosts: | |
nginx-webroot: | |
networks: | |
default: | |
external: | |
name: nginx-proxy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks for sharing this great gist!
I had to open the ssh port manually (and remap because port 22 is already use on my machine).
Does
git clone ssh:
work out of the box with your config?This are the additions I had to make: