Skip to content

Can't evaluate fields in template strings #273

@vivanov1410

Description

@vivanov1410

Gentlemen, I started to have issues with format templates after I upgraded docker engine from 1.12 to 1.13.

Steps to reproducte

  1. I run a docker service using following command
docker service create --name logspout \
  --network mejai-network \
  --mode global \
  --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
  --env SYSLOG_HOSTNAME='{{index .Config.Labels "com.docker.swarm.service.name"}}' \
  --env SYSLOG_TAG='{{.Name}}' \
  --env SYSLOG_STRUCTURED_DATA='cluster={{index .Config.Labels "ca.surrey.swarm.cluster"}}' \
  gliderlabs/logspout $ELK

Actual result

Error response from daemon: rpc error: code = 3 desc = expanding env failed: expanding env "SYSLOG_HOSTNAME={{index .Config.Labels \"com.docker.swarm.service.name\"}}": template: expansion:1:15: executing "expansion" at <.Config.Labels>: can't evaluate field Config in type *template.Context

But if I run docker inspect --format {{.Config.Labels}} dda42680d044 it all works.

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions