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

docker

#1

Hi,

It is not possible to set the container name using the container_name field in the docker-compose.yml as is also documented in https://www.balena.io/docs/reference/supervisor/docker-compose/

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 https://github.com/influxdata/telegraf/tree/master/plugins/inputs/docker)

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


#2

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

For more details see: https://github.com/janvda/balena-node-red-mqtt-nginx-TIG-stack/issues/10