Last active
September 21, 2024 09:27
-
-
Save cuxaro/e0136844a32598a2a22f142e158d1ec1 to your computer and use it in GitHub Desktop.
Montar un sistema docker en el que cuando se agrega un nuevo servicio con un dominio se automanitamente se monta, se puede acceder por el 80 y 443 y se genera un certificado gestionado con Lets Encrypt
This file contains hidden or 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-proxy-gen: | |
container_name: nginx-proxy-gen | |
image: nginxproxy/docker-gen | |
command: -notify-sighup nginx-proxy -watch -wait | |
volumes_from: | |
- nginx-proxy | |
volumes: | |
- ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro | |
- /var/run/docker.sock:/tmp/docker.sock:ro | |
labels: | |
- "com.github.nginx-proxy.docker-gen" | |
networks: | |
- nginx_network # Conectar a la red compartida | |
nginx-proxy: | |
image: nginxproxy/nginx-proxy:alpine | |
container_name: nginx-proxy | |
ports: | |
- "80:80" | |
- "443:443" | |
volumes: | |
- /var/run/docker.sock:/tmp/docker.sock:ro | |
- ./certs:/etc/nginx/certs | |
- ./vhost.d:/etc/nginx/vhost.d | |
- ./html:/usr/share/nginx/html | |
- ./conf.d:/etc/nginx/conf.d | |
environment: | |
- DEFAULT_HOST=docker.DOMAIN.com | |
restart: always | |
networks: | |
- nginx_network # Conectar a la red compartida | |
acme-companion: | |
image: nginxproxy/acme-companion | |
container_name: nginx-proxy-acme | |
environment: | |
- [email protected] | |
volumes_from: | |
- nginx-proxy | |
volumes: | |
- ./certs:/etc/nginx/certs:rw | |
- ./acme:/etc/acme.sh | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
depends_on: | |
- nginx-proxy | |
restart: always | |
networks: | |
- nginx_network # Conectar a la red compartida | |
networks: | |
nginx_network: | |
external: true # Usar la red externa creada | |
This file contains hidden or 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
#TODO LO ANTERIOR DEL docker-compose.yaml | |
version: '3.8' | |
services: | |
doom: | |
image: callumhoughton22/doom-in-docker:0.1 | |
container_name: doom | |
restart: unless-stopped | |
environment: | |
- VIRTUAL_HOST=doom.DOMAIN.com | |
- VIRTUAL_PORT=8080 | |
- LETSENCRYPT_HOST=doom.DOMAIN.com | |
- [email protected] | |
networks: | |
- nginx_network # | |
networks: | |
nginx_network: | |
external: true # Usar la red externa creada |
This file contains hidden or 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
#Crear una network para que se puedan comunicar entre los dockers | |
docker network create nginx_network |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment