Allow to set container name in docker-compose.yml or alternative solution




It is not possible to set the container name using the container_name field in the docker-compose.yml as is also documented in

The actual problem is that a container with each restart or redeployment gets a new container name (e.g. the container name grafana_642983_676605 changes after a restart or redeployment into grafana_643088_676648). This is very inconvenient when you want to use grafana for displaying the system metrics of the different docker containers as it is using the container_name as a way to identify the docker containers (see

So I am looking for a solution that doesn’t change the name of the docker container with each redeployment/restart.


I fixed it by adding a telegraf processor that is replacing a container_name like influxdb_643150_676670 into influxdb

For more details see: