Home > front end >  Docker container immediately exists after loading from compose file (exit code 0)
Docker container immediately exists after loading from compose file (exit code 0)

Time:03-15

Perhaps I'm missing something obvious, but I just tried to add the firebase-tools docker image to my docker-compose file:

version: '3.6'
services:
  firebase-tools-test:
    tty: true
    image: andreysenov/firebase-tools
    ports: 
      - 9099:9099
      - 4000:4000
      - 5000:5000
      - 5001:5001
      - 9199:9199
      - 9005:9005
      - 9000:9000
      - 8085:8085
      - 8080:8080

Howeber when running it immediatly exists with exit code 0. Logs don't show anything at all and I wanted to know if this was a simple misconfiguration and how I could get more verbose logging to see why it's exiting.

CodePudding user response:

Docker does not keep your container running by default. If things done it will exit it. To keep it waiting for input create TTY by using docker run -it for interactive or docker run -dt for detached mode. For compose it would be tty: true, alternatively you overwrite the given CMD by something like

entrypoint: ["tail"]
command: ["-f","/dev/null"]

or command: tail -F anything or another mimic keeping a process running forever..

Remark: This works because the container is just running sh anyways. If there is something different in CMD you have to call that and chain above by command: <command to start container logic> && tail -F anythingor something like that.

  • Related