How to deal with state "Exit 0" in Docker

ReynierPM picture ReynierPM · Oct 18, 2016 · Viewed 16.9k times · Source

I have build a Docker image and afterwards run a container using Docker Compose. The following command will do the job for me:

docker-compose up -d

I have restarted the PC and now I want to start the previous container that I've created before. So I have tried the following command:

$ docker-compose start 
Starting php-apache ... done

Apparently it works but it doesn't as per the output for the following command:

$ docker-compose ps
          Name                         Command               State    Ports 
---------------------------------------------------------------------------
php55devwork_php-apache_1   /bin/sh -c bash -C '/usr/l ...   Exit 0        

For sure something is wrong and I am trying to find out what.

  • How do I find why the command is failing?
  • Is there any place where I could see a log file or something that help me to identify and fix the error?

Here is the repository if you want to give it a try.

Update

If I remove the container: docker rm <container-id> and recreate it by running docker-compose up -d --build it works again.

Update #1

I am not able to see such weird characters:

enter image description here

Answer

pelican picture pelican · Jun 22, 2018

This is what helped me to resolve this issue: Under one of your services in the docker-compose yaml file, type in the following:

tty: true so it'll look like

version: '3'

services: 
   web: 
     tty: true

Hopefully this helps someone; thumps up if it helps you :)