After some trial and error, I learned how to put multiple containers behind ssl, using swag and swag-auto-proxy. This is really nice because there is no need to modify configuration files (nginx/proxy-confs). Everything is defined in docker-compose.yml. For example:
services:
swag:
image: lscr.io/linuxserver/swag
container_name: swag
hostname: swag
restart: unless-stopped
cap_add:
- NET_ADMIN
environment:
- PUID=1001
- PGID=1001
- URL=my_domain.com
- SUBDOMAINS=www,portainer
- VALIDATION=http
- CERTPROVIDER=zerossl
- EMAIL=my@email.net
- DOCKER_MODS=linuxserver/mods:universal-docker|linuxserver/mods:swag-auto-proxy
networks:
- network
ports:
- 80:80
- 443:443
volumes:
- swag:/config
- /var/run/docker.sock:/var/run/docker.sock:ro
portainer:
image: portainer/portainer-ce:latest
container_name: portainer
hostname: portainer
restart: unless-stopped
environment:
- PUID=1001
- PGID=1001
networks:
- network
ports:
- 9000:9000
volumes:
- portainer:/data
- /var/run/docker.sock:/var/run/docker.sock
labels:
- swag=enable
networks:
network:
volumes:
swag:
portainer:
I was wondering if it’s possible to also host multiple domains. Not subdomains under the same domain.
I know it can be done by creating configuration files under “nginx/site-confs” but I was wondering if it can also be done using only docker-compose.yml and the “swag-auto-proxy”.
The way I imagine it, is I create wordpress containers, each one for a different domain and configure them in docker-compose.yml to use swag with the “swag-auto-proxy” mod, to automatically use ssl.
Is this possible?