2

I'm using docker compose to create a bunch of containers, and the internal hostname is the container ID; when each container registers its hostname in ... whatever (but consul in this instance) it's hard to tell the hosts apart.

In particular, when combined with --scale, I end up with something like the following:

09f62d66a050.docker_default
56f1dc03a54c.docker_default
772799d94048.docker_default
983c5cda71c7.docker_default
a7c77bb2dd98.docker_default

I can't just set hostname in docker-compose.yml (because I'm using --scale).

How do I add a prefix to the generated hostname?

I'm cool with my hosts being called web-56f1dc03a54c, web-a7c77bb2dd98, redis-09f62d66a050, etc.

Roger Lipscombe
  • 2,057
  • 5
  • 24
  • 37

0 Answers0