Dockerfile CMD`command not found` [英] Dockerfile CMD `command not found`

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

问题描述

我有以下 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`command not found`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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