skip to Main Content

I have a Virtualbox VM running debian 10.11 whith docker, everything is up to date.
I want to start a very basic container from a debian image using deocker-compose.

I have the following docker-compose.yml file

version: "3"
services:
  deb1:
    image: debian:latest

I run the command sudo docker-compose up -d but the container is not running when running sudo docker ps -a so I try to start manually sudo docker start <container_id> but the container is still not running and I have a success return code (echo $?).

It works well when I use docker command to create the container sudo docker run -td --name deb1 --hostname deb1 debian:latest

Does someone have any idea to fix that ?

thanks
Louis

2

Answers


  1. Chosen as BEST ANSWER

    UPDATE: a container can only work if a service is running inside. As David Maze said, the Debian image can be extended in a Dockerfile for example.


  2. You can add command: tail -f /dev/null to you compose file to keep container running:

    version: "3"
    services:
      deb1:
        image: debian:latest
        command: tail -f /dev/null
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search