Docker Community Forums

Share and learn in the Docker community.

Containers started with docker-compose up stop immediately

docker

(Zwarag) #1

My containers immediately turn off after they have done provisioning.
But I actually would like them to keep running.

The setup is that I have 3 nodejs project that run on the same image.

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

And the docker-compose.yml

dashboard:
    image: "nd"
    volumes:
    - dashboard:/app
    - logvolume01:/var/log
    command: "npm i && npm i -g gulp && gulp &"
lobby:
    image: "nd"
    ports:
    - "3000:3000"
    - "3333:3333"
    volumes:
    - lobby:/app
    command: "bash -c 'npm i && npm i -g gulp && gulp &'"
    links:
    - dashboard
game:
    image: "nd"
    ports:
    - "5000:5000"
    volumes:
    - game:/app
    command: "npm i && npm i -g gulp && gulp &"
    links:
    - dashboard

(Dvohra) #2

Do the Docker containers exit? Run Docker image with -dt option.

docker run -dt

The option “t” is for tty(stdio/stdout)