dockerfile 中的语法错误未终止引用字符串
syntax error unterminated quoted string in dockerfile
我创建了一个如下所示的 Dockerfile:
FROM consul
COPY config-file.json /consul/config
ENTRYPOINT ["consul", "agent, "-config-file=/consul/config/config-file.json"]
config(config-file.json)文件如下所示:
{
"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"
}
然后 运行 容器并得到以下内容:
dockerizer@docker1:~/consul$ docker run --rm -ti --network=host servery
/bin/sh: syntax error: unterminated quoted string
我做错了什么?
您的 ENTRYPOINT 中单词 "agent" 后缺少引号。
ENTRYPOINT ["consul", "agent", "-config-file=/consul/config/config-file.json"]
这个缺失的引号是导致未终止引号消息的原因,因此评估或执行的 ENTRYPOINT 显示为 consul agent "-config-file=/consul/config/config-file.json
(缺少引号)
我创建了一个如下所示的 Dockerfile:
FROM consul
COPY config-file.json /consul/config
ENTRYPOINT ["consul", "agent, "-config-file=/consul/config/config-file.json"]
config(config-file.json)文件如下所示:
{
"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"
}
然后 运行 容器并得到以下内容:
dockerizer@docker1:~/consul$ docker run --rm -ti --network=host servery
/bin/sh: syntax error: unterminated quoted string
我做错了什么?
您的 ENTRYPOINT 中单词 "agent" 后缺少引号。
ENTRYPOINT ["consul", "agent", "-config-file=/consul/config/config-file.json"]
这个缺失的引号是导致未终止引号消息的原因,因此评估或执行的 ENTRYPOINT 显示为 consul agent "-config-file=/consul/config/config-file.json
(缺少引号)