magic pony
magic pony

Reputation: 33

docker-compose up -d failed

I wrote a simple docker-compose.yml as bellow,

version: '3'
services:
  ubuntu:
    container_name: ubuntu
    image: ubuntu

  debian:
    container_name: debian
    image: debian

then ran

$ docker-compose up -d

finally I got two containers with exited status. enter image description here

even I typed

$ docker start <container_id>

trying to make containers running, but still fail.

Anyone tell me how to fix my yaml file, to make this two containers run with 'docker-compose up -d' ?

Upvotes: 0

Views: 387

Answers (1)

Nguyen Lam Phuc
Nguyen Lam Phuc

Reputation: 1421

The entrypoint and command for these 2 docker images ubuntu and debian will not do anything that keep the container running.

In case you want them to keep running, you can modify your docker-compose file like this

version: '3'
services:
  ubuntu:
    container_name: ubuntu
    image: ubuntu
    entrypoint:
      - bash
      - -c
    command:
      - |
        tail -f /dev/null

  debian:
    container_name: debian
    image: debian
    entrypoint:
      - bash
      - -c
    command:
      - |
        tail -f /dev/null

Upvotes: 1

Related Questions