我的容器在完成配置后立即转动 但我实际上希望他们继续跑步。
设置是我有3个nodejs项目在同一个图像上运行。
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install curl -y
RUN apt-get install software-properties-common -y
RUN curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
RUN apt-get update
RUN apt-get install nodejs -y
RUN curl -L https://www.npmjs.com/install.sh | sh
WORKDIR /app
和docker-compose.yml
dashboard:
image: "nd"
volumes:
- dashboard:/app
- logvolume01:/var/log
command: "npm i && npm i -g gulp && gulp &"
environment:
- NODE_VER=stable
lobby:
image: "nd"
ports:
- "3000:3000"
- "3333:3333"
volumes:
- lobby:/app
command: "bash -c 'npm i && npm i -g gulp && gulp &'"
links:
- dashboard
environment:
- NODE_VER=stable
game:
image: "nd"
ports:
- "5000:5000"
volumes:
- game:/app
command: "npm i && npm i -g gulp && gulp &"
links:
- dashboard
environment:
- NODE_VER=stable
答案 0 :(得分:0)
Docker需要前台进程,但您的命令正在使用&
将其发送到后台。如果删除&
,它应该保留在前台,容器将继续运行。