docker-compose label constraints

Hi,

Is there a specific reason the following docker-compose label format is not allowed?

Invalid label name: “traefik.http.routers.app-secure.tls.domains[0].main”.
Label names must only contain alphanumeric characters, periods “.” and dashes “-”.

I want to use it to define some settings from our reverse proxy container (traefik).
Now I have to configure these settings with a separate configuration file injected into the container.

Best Regards,

Thijs

Hi there! This doc : https://docs.docker.com/config/labels-custom-metadata/ should be able to provide some info on that. Cheers!

It seems these are “recommendations” not requirements.

Enforcing these as constraints makes deployments significantly more difficult. In a multi-container deployment passing configuration to containers like traefik or lucaslorentz/caddy-docker-proxy is impeded by these constraints. Since bind mounting config files into the containers is not an option see Allowing bind-mounts for "relative paths" in a limited directory scope that the supervisor controls and can purge · Issue #643 · balena-os/balena-supervisor · GitHub this forces users to build custom containers with config baked in which seems like bad practice.

Hi @techplex, I think you are right. I am not sure why the restriction on label names was added in the first place but I agree it does not seem to make sense anymore. I have created the issue Remove restrictions on docker labels · Issue #1949 · balena-os/balena-supervisor · GitHub to address this and we will let you know when this is solved.

Although we cannot promise an ETA on the improvement it seems like something that should be easy to address.

1 Like