/ bin / sh:1:[“ npm”,::在docker-compose up上找不到 [英] /bin/sh: 1: [“npm”,: not found on docker-compose up
本文介绍了/ bin / sh:1:[“ npm”,::在docker-compose up上找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是docker的新手,正在尝试为节点应用程序创建容器。
I'm new to docker and trying to create a container for node apps.
我遵循了以下教程,但是在 docker-compose up
我总是遇到以下错误:
I followed these tutorial, but on docker-compose up
I'm getting always these error:
Creating app ... done
Attaching to app
app | /bin/sh: 1: ["npm",: not found
app exited with code 127
这是我的Dockerfile:
Here is my Dockerfile:
FROM node:latest
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
COPY package-lock.json /usr/src/app/
RUN npm install
COPY . /usr/src/app
EXPOSE 3000
CMD ["npm", "start"]
和我的docker-compose.yml:
and my docker-compose.yml:
version: "2"
services:
app:
container_name: app
restart: always
build: .
ports:
- "3000:3000"
有人知道如何解决这个错误?
Has anyone an idea how to fix this error?
推荐答案
在dockerfile中,引号有误:
You have the wrong quotes in your dockerfile:
app | /bin/sh: 1: ["npm",: not found
与引号不匹配在您粘贴的示例中:
doesn't match the quotes in the example you pasted:
CMD ["npm", "start"]
再次检查您的Dockerfile以更正报价。
Double check your Dockerfile to correct your quotes.
这篇关于/ bin / sh:1:[“ npm”,::在docker-compose up上找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文