New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid interpolation format for "command" option in service "node-exporter": "^/(sys|proc|dev|host|etc)($|/)" #4485

Closed
HaoHappen opened this Issue Feb 15, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@HaoHappen

HaoHappen commented Feb 15, 2017

I want to manage my Swarm services using Docker Compose YAML format
docker command:

docker service create --name node-exporter \
--mode global \
--network proxy \
--mount "type=bind,source=/proc,target=/host/proc" \
--mount "type=bind,source=/sys,target=/host/sys" \
--mount "type=bind,source=/,target=/rootfs" \
--mount "type=bind,source=/etc/hostname,target=/etc/host_hostname" \
-e HOST_HOSTNAME=/etc/host_hostname \
basi/node-exporter:v0.1.1 \
-collector.procfs /host/proc \
-collector.sysfs /host/proc \
-collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)" \
-collector.textfile.directory /etc/node-exporter/ \
-collectors.enabled="conntrack,diskstats,entropy,filefd,filesystem,loadavg,m\
dadm,meminfo,netdev,netstat,stat,textfile,time,vmstat,ipvs"

compose.yml:

version: "3"
services:
  node-exporter:
    image: basi/node-exporter:v0.1.1
    networks:
      - mm
    volumes:
      - /proc:/host/proc
      - /sys:/host/sys
      - /:/rootfs
      - /etc/hostname:/etc/host_hostname
    environment:
      - HOST_HOSTNAME=/etc/host_hostname
    command: [ -collector.procfs,/host/proc,-collector.sysfs=/host/proc,-collector.filesystem.ignored-mount-points,"^/(sys|proc|dev|host|etc)($|/)",-collector.textfile.directory,/etc/node-exporter/,-collectors.enabled="conntrack,diskstats,entropy,filefd,filesystem,loadavg,mdadm,meminfo,netdev,netstat,stat,textfile,time,vmstat,ipvs"]
    deploy:
      mode: global

But got an error:Invalid interpolation format for "command" option in service "node-exporter": "^/(sys|proc|dev|host|etc)($|/)"
It seems that symbol $ caused. What format should I write it?

@shin-

This comment has been minimized.

Member

shin- commented Feb 15, 2017

You can escape the $ symbol with another $. See the variable substitution docs for more info.

@shin- shin- added the kind/question label Feb 15, 2017

@HaoHappen

This comment has been minimized.

HaoHappen commented Feb 17, 2017

thanks!

@HaoHappen HaoHappen closed this Feb 17, 2017

@sobi3ch

This comment has been minimized.

sobi3ch commented Sep 17, 2018

Spent over an hour to find this answer. Thank you.

@sobi3ch

This comment has been minimized.

sobi3ch commented Sep 17, 2018

You can use a $$ (double-dollar sign) when your configuration needs a literal dollar sign. This also prevents Compose from interpolating a value, so a $$ allows you to refer to environment variables that you don’t want processed by Compose.

web:
  build: .
  command: "$$VAR_NOT_INTERPOLATED_BY_COMPOSE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment