Dockerfile CMD`找不到命令` [英] Dockerfile CMD `command not found`

查看:59
本文介绍了Dockerfile CMD`找不到命令`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下 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

我收到以下错误:

/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?

推荐答案

你使用了错误的引号.应该是:

You are using wrong quotes. It should be:

CMD ["bash", "npm run lint"]

这篇关于Dockerfile CMD`找不到命令`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆