简体   繁体   English

docker run image导致语法错误/ bin / sh

[英]docker run image causes syntax error /bin/sh

When I run docker command on my image, it errors out. 当我在映像上运行docker命令时,它会出错。 Any ideas on what should I include in my Dockerfile for CMD? 关于我应该在CMD的Dockerfile中包含什么的任何想法? Currently I have java -jar my.jar in it. 目前我有java -jar my.jar

docker run startlog
/bin/sh: 1: Syntax error: Unterminated quoted string

From your comment (this should really be an edit to your question): 根据您的评论(这实际上应该是对您的问题的修改):

FROM openjdk:8
RUN mkdir -p /tmp/startlog/
ADD gs-rest-hateoas-0.1.0.jar /tmp/startlog/
EXPOSE 8080
ENTRYPOINT ["java", "-jar", “/tmp/startlog/gs-rest-hateoas-0.1.0.jar"]

you do not have a double quote in front of /tmp/startlog , instead you have a "smart quote" which is invalid for programming. 您没有在/tmp/startlog前面加双引号,而是有一个“智能引号”,这对于编程无效。 Please ditch whatever editor created that and don't use it for any more coding. 请放弃任何编辑器创建的内容,不要再将其用于任何编码。

What happened with the smart quote is that the entrypoint json was not valid json, so it gets run as 智能引号发生的是入口点json不是有效的json,因此它以

/bin/sh -c '["java", "-jar", “/tmp/startlog/gs-rest-hateoas-0.1.0.jar"]'

And before /bin/sh looks for the command ["java", it sees a parsing problem with the unmatched quotes. 在/ bin / sh查找命令["java",它会看到引号不匹配的解析问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM