Docker Community Forums

Share and learn in the Docker community.

Docker-compose v2 {{.Name}} structures <No Value>

Hi there,

The issue is that tag: '{{.Name}}' does not resolve to a container name.

We use Docker with Rancher and Jenkins. Within this mix we have a problem which has occurred recently.

      driver: awslogs
        awslogs-region: eu-central-1
        awslogs-group:  $LOGGING_CONTEXT-$RANCHER_STACK
        awslogs-create-group: true
        tag: '{{.Name}}'

The first image is from our docker-compose v2 and the second from our rancher environment. I believe that “tag” should be evaluated to docker’s name for the container before being passed to Rancher.

During initial setup, I experimented with the tag: '{{.Name}}' syntax, at the time I found that unique container names weren’t helpful as log names but the syntax did work.

Previously, we were using a hard coded string here but with the move to multiple containers our goal is to generate a tag with a sensible name and some kind or ordinal or distinct identifier.

Any insight or guidance would be gratefully received, thank you.