Skip to content
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

@HaoHappen
Copy link

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-
Copy link

shin- commented Feb 15, 2017

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

@HaoHappen
Copy link
Author

thanks!

@sobi3ch
Copy link

sobi3ch commented Sep 17, 2018

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

@sobi3ch
Copy link

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"

0x326 added a commit to 0x326/geode-docker that referenced this issue Apr 20, 2020
BeEdward added a commit to BeEdward/quick-question that referenced this issue Mar 17, 2023
wsxiaoys pushed a commit to TabbyML/quick-question that referenced this issue Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants