Search code examples
dockerconsul

syntax error unterminated quoted string in dockerfile


I created a Dockerfile that looks as follow:

FROM consul

COPY config-file.json /consul/config

ENTRYPOINT ["consul", "agent, "-config-file=/consul/config/config-file.json"]

The config( config-file.json) file that looks as follow:

{
  "datacenter": "microservices",
  "data_dir": "/opt/consul",
  "log_level": "INFO",
  "disable_host_node_id" : true, 
  "server": true,
  "bootstrap_expect" : 2,
  "client_addr": "0.0.0.0",
  "ui": true,
  "bind_addr": "192.168.70.20"
}

then run the container and got following:

dockerizer@docker1:~/consul$ docker run --rm -ti --network=host servery
/bin/sh: syntax error: unterminated quoted string

What am I doing wrong?


Solution

  • You're missing a quote in your ENTRYPOINT after the word "agent".

    ENTRYPOINT ["consul", "agent", "-config-file=/consul/config/config-file.json"]

    This missing quote is what's causing the unterminated quote message, so the evaluated or executed ENTRYPOINT appears as consul agent "-config-file=/consul/config/config-file.json (which is missing a quote)