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.