I use docker with COMPOSE_PROJECT_NAME
to dynamically create container names. Somewhere in the last 2 months something changed and my local machine generates container names with hypens
.
e.g project-name-traefik-1
instead of project-name_traefik_1
.
How can I change this behavior as this breaks functionality on my linux docker server which for some reason keeps the old container naming structure.
I have the latest Docker Desktop and the latest Docker on the server. I can't find anything in the documentation that points to this change.
Resorted to adding container_name
(which wasn't previously needed).
I'm also using the COMPOSE_PROJECT_NAME
environment variable to get predictable container names.
E.g.
...
nginx:
image: graffino/nginx:v1
restart: unless-stopped
container_name: ${COMPOSE_PROJECT_NAME}-nginx
...