Dockerfile CMD `command not found`

2019-02-24 01:12发布

I have the following Dockerfile:

FROM nodesource/node:jessie

ADD ./ /SOMEPATH

RUN cd /SOMEPATH && npm install

WORKDIR /SOMEPATH

CMD [“bash”, “npm run lint”]

When I build and run this image using this command:

docker run -v $(pwd):/SOMEPATH Name_of_image

I get the following error:

/bin/sh: 1: [“bash”,: not found

However, when I run the image like this, it works:

docker run -v $(pwd):/SOMEPATH Name_of_image NAME_OF_TASK 

So, why does this work? And why doesn't the other one work?

1条回答
Emotional °昔
2楼-- · 2019-02-24 01:26

You are using wrong quotes. It should be:

CMD ["bash", "npm run lint"]
查看更多
登录 后发表回答