lucaslorentz / caddy-docker-proxy

Caddy as a reverse proxy for Docker
MIT License
3.02k stars 173 forks source link

Docker Recommendations for label syntax exclude underscores #362

Open TechplexEngineer opened 2 years ago

TechplexEngineer commented 2 years ago

The docker recommendations for label syntax say that "Label keys should begin and end with a lower-case letter and should only contain lower-case alphanumeric characters, the period character (.), and the hyphen character (-)." https://docs.docker.com/config/labels-custom-metadata/

I am trying to use Balena to deploy Caddy with some other services that it reverse proxies. The label "caddy.reverse_proxy" is invalid per the validation in the Balena tool.

My first thought is to allow "hyphens" where underscores are used and convert them before rendering the caddy file.

I'd appreciate any thoughts.

Related thread on Balena Forum: https://forums.balena.io/t/docker-compose-label-constraints/55756

francislavoie commented 2 years ago

Yeah I'd say Balena should fix it. They're being overly restrictive for no good reason. It's always worked with underscores 🤷‍♂️

TechplexEngineer commented 2 years ago

I agree with you, however I'm at their mercy. Would you be interested in a PR with a small change support hyphens as a replacement for underscores?

This seems like a pretty trivial change. The tests pass, but I'm not a caddy expert, are there any special cases we need to be sure to handle? https://github.com/TechplexEngineer/caddy-docker-proxy/pull/1/files

francislavoie commented 2 years ago

That's gross. It really limits future use of - for another purpose later. Not a fan. I'd rather see if Balena would acquiesce to a change first.

TechplexEngineer commented 2 years ago

I've submitted a support ticket, but given the age of that forum post, I'm not hopeful.