Containers Outside of Compose Project
Adding other Containers to Traefik
Section titled “Adding other Containers to Traefik”If a container exists outside of this Compose project but on the same host, you can add them to Traefik so they can also have TLS/SSL
-
Add the
HMSD_DOMAINand the domain you use to a new or existing.envfile that your other containers reference with the value of your domain used for this project -
Add the
hms-docker_proxy_netnetwork to the container along with the following required labels:myothercontainer.yml services:mycontainer:image: mycontainerimage:latest...network:- hms-docker_proxy_netlabels:- traefik.enable=true- traefik.http.services.<container name>.loadbalancer.server.port=<web UI port for container>- traefik.http.routers.<container name>.rule=Host(`<subdomain name>.${HMSD_DOMAIN}`)# The following restricts it to only internal IP addresses. If you want to add additional security controls and have traefik_security_hardening enabled, you can change this to `internal-secured@file`# See the 'Middlewares' section in the 'Services and Integrations/Traefik/Security' documentation- traefik.http.routers.<container name>.middlewares=internal-ipallowlist@file...networks:- hms-docker_proxy_netexternal: true... -
Add DNS records (if necessary)
-
Recreate the container(s) you just added labels to
-
Check to see if it is working correctly
Adding External Services to Traefik
Section titled “Adding External Services to Traefik”You can add external services (such as services running on another host/server, like an external grafana server) to this projects Traefik config.
In inventory/group_vars/all/traefik.yml you must set traefik_ext_hosts_enabled to yes, and add the correct items to the traefik_ext_hosts_list array.