How to define an external service in a docker compose yaml file?

Hi,

I would like to define the routing to an external service in my docker compose yaml file.
I don't know how to do this and if this is possible.

I know how to set this up in a yaml file for the dynamic configuration (using file provider) but then I cannot use environment variables (as this is not supported).

FYI. this is the external service I want to define the routing to based on specific public host name myservice.nuc123.onmypc.org.

  services:
    pi3one:
      loadBalancer:
        servers:
          - url: "http://192.168.1.131:1880"
        passHostHeader: true

Hello,

It's not possible, you have to use the file provider for that.

If you want to use env vars with the file provider, you can use Go templating and sprig functions.

1 Like

See also follow up question How to use environment variables in the dynamic configuration (using file provider)?