Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
成功完成yurn start后,Node.js docker容器退出,退出代码为0_Node.js_Docker_Containers_Vue Storefront - Fatal编程技术网

成功完成yurn start后,Node.js docker容器退出,退出代码为0

成功完成yurn start后,Node.js docker容器退出,退出代码为0,node.js,docker,containers,vue-storefront,Node.js,Docker,Containers,Vue Storefront,my Dockerfile bellow成功生成: FROM node:10-alpine ENV VS_ENV prod WORKDIR /var/www COPY shims.d.ts ./ COPY tsconfig.json ./ COPY tsconfig-build.json ./ COPY package.json ./ COPY yarn.lock ./ COPY config ./config COPY core ./core COPY ecosystem.json ./

my Dockerfile bellow成功生成:

FROM node:10-alpine

ENV VS_ENV prod

WORKDIR /var/www

COPY shims.d.ts ./
COPY tsconfig.json ./
COPY tsconfig-build.json ./
COPY package.json ./
COPY yarn.lock ./
COPY config ./config
COPY core ./core
COPY ecosystem.json ./
COPY .eslintignore ./
COPY .eslintrc.js ./
COPY lerna.json ./
COPY package.json ./
COPY src ./src

RUN apk add --virtual .build-deps ca-certificates wget python make g++ \
  && apk add git \
  && yarn install \
  && yarn build
然后我用以下命令运行容器:

docker run -it -p 3000:3000 vue/sf:4a yarn start
日志显示,据我所知,应用程序已启动:

[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2] PM2 Successfully daemonized
[PM2][WARN] Applications server not running, starting...
[PM2] App [server] launched (4 instances)
┌──────────┬────┬─────────┬─────┬────────┬─────────┬────────┬─────┬───────────┬──────┬──────────┐
│ App name │ id │ mode    │ pid │ status │ restart │ uptime │ cpu │ mem       │ user │ watching │
├──────────┼────┼─────────┼─────┼────────┼─────────┼────────┼─────┼───────────┼──────┼──────────┤
│ server   │ 0  │ cluster │ 52  │ online │ 0       │ 0s     │ 34% │ 72.5 MB   │ root │ disabled │
│ server   │ 1  │ cluster │ 59  │ online │ 0       │ 0s     │ 28% │ 61.0 MB   │ root │ disabled │
│ server   │ 2  │ cluster │ 70  │ online │ 0       │ 0s     │ 24% │ 35.3 MB   │ root │ disabled │
│ server   │ 3  │ cluster │ 81  │ online │ 0       │ 0s     │ 20% │ 30.0 MB   │ root │ disabled │
└──────────┴────┴─────────┴─────┴────────┴─────────┴────────┴─────┴───────────┴──────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app
Done in 2.08s.
有什么想法吗?我做错了什么


谢谢

您的容器退出状态为0,这意味着一切都按预期进行。您的应用程序似乎只是启动了一些服务,然后退出。我们需要查看运行应用程序的命令。此外,我们可能需要查看您的源代码

顺便说一下,如果您运行的命令与pm2相关,请尝试使用--no daemon选项启动pm2

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                      PORTS               NAMES
8b77d6ffe26e        vue/sf:4            "docker-entrypoint.s…"   11 minutes ago      Exited (0) 11 minutes ago                       keen_raman