Docker “Gracefully stopping” itself during `docker-compose up` but not `docker-compose run –entrypoint`

When I start a Docker container with docker-compose up, it starts up as usual, but eventually the container automatically exits without anything that I can tell is useful in the verbose log.

When I instead run docker-compose up --entrypoint run-tests.sh with the same docker-compose.yml configuration (with the same entrypoint set) and the same Dockerfile, the Docker container says “Gracefully stopping” on its own and stops all containers.

  • multiple eth configuration using docker
  • How to expose a Docker network to the host machine?
  • Using Ansible docker_service module to deploy service to swarm
  • Docker build: read-only file system
  • How to efficiently get info from all Docker containers running on a server via SSH?
  • Persist Changes for boot2docker guest additions
  • The bad behaviour seems to come from running docker-compose up instead of the equivalent docker-compose run.

    The container seems to stay up for varying times before it shuts down. In one instance it stayed up for 7 minutes, different times in others.

    Does anyone know how to troubleshoot this?

    Docker versions:

    Docker version 1.9.0, build 76d6bc9
    docker-compose version: 1.5.0
    docker-machine version 0.5.0 (HEAD)
    

    The docker-compose --verbose up log:

    docker-compose --verbose --project-name monkeycore up monkeycore-autotest
    ... lots of startup log (let me know if you need to see this) ...
    # Scala Play1 Framework tests, not likely relevant
    monkeycore-autotest_1 | ~ MonkeyTest...                   PASSED     30s
    monkeycore-autotest_1 | ~ WhateverDataTest...             PASSED     33s
    monkeycore-autotest_1 | ~ SauceTest...                    PASSED     1 min 44s
    Gracefully stopping... (press Ctrl+C again to force)
    compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={u'label': [u'com.docker.compose.project=monkeycore', u'com.docker.compose.oneoff=False']})
    compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 2 items)
    compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u'617bf28c3f7ae3779f383f7e2a96f66e552e92f755a15d07ac6b73329ba3860f')
    compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u'AppArmorProfile': u'',
     u'Args': [u'-c', u'build.sh && play auto-test'],
     u'Config': {u'AttachStderr': False,
                 u'AttachStdin': False,
                 u'AttachStdout': False,
                 u'Cmd': None,
                 u'CpuShares': 0,
                 u'Cpuset': u'',
                 u'Domainname': u'',
                 u'Entrypoint': [u'bash', u'-c', u'build.sh && play auto-test'],
    ...
    compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u'4963e9287ed10d587a79f57a52eaf86c07c6947b2119072bd5d68a3ed0eb161e')
    compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u'AppArmorProfile': u'',
     u'Args': [u'/usr/local/etc/redis/redis.conf'],
     u'Config': {u'AttachStderr': False,
                 u'AttachStdin': False,
                 u'AttachStdout': False,
                 u'Cmd': None,
                 u'CpuShares': 0,
                 u'Cpuset': u'',
                 u'Domainname': u'',
                 u'Entrypoint': [u'redis-server',
    ...
    Stopping monkeycore_monkeycore-autotest_1 ...
    compose.cli.verbose_proxy.proxy_callable: docker stop <- (u'617bf28c3f7ae3779f383f7e2a96f66e552e92f755a15d07ac6b73329ba3860f', timeout=10)
    Stopping monkeycore_monkeycore-autotest_1 ... done
    ERROR: compose.cli.main.main: Couldn't connect to Docker daemon - you might need to run `docker-machine start default`.
    

    docker-compose.yml:

    monkeycore-base:
        build: ../
        dockerfile: "docker/monkeycore/Dockerfile"
        ports:
          - "8000:8000"
          - "8082:8082"
          - "9000:9000"
        stdin_open: true
        tty: true
        working_dir: "/path/to/dir"
        volumes:
          - src:dest
        environment:
          LOTS_OF_ENVIRONMENT_VARIABLES: "defined"
    
    monkeycore-autotest:
        extends:
          service: monkeycore-base
        links:
          - redis
        entrypoint: "run-tests.sh"
    
    redis:
        build: ./redis
        ports:
          - "6379:6379"
    

  • How to install a non-distro package inside Docker without wasting space?
  • Load data from host machine to docker hive container
  • Get command used to start a Docker container
  • How to compile C code that is using kernel function in docker and use pci device in container?
  • Where are docker images stored by boot2docker?
  • Windows base image for docker
  • 2 Solutions collect form web for “Docker “Gracefully stopping” itself during `docker-compose up` but not `docker-compose run –entrypoint`”

    I was having the same problem. There’s an open issue for that at Compose’s repository.

    In the issue someone suggested, as a workaround, to run docker-compose up -d. That way containers will keep running even if there’s a connection failure.
    To see the container logs just run docker-compose logs.

    That suggestion solved the problem for now without having to worry to downgrade Compose.

    For some reason your docker client lost comunication with you docker engine. Probably some issue on monkeycore_monkeycore-autotest_1 container caused it.

    Check if your docker machine is still running:

    $ docker machine ls
    

    and if your envs variables are set, the ‘docker’ ones:

    env | grep -i "docker"
    

    Try to restart your docker-machine, reset your env vars

    eval "$(docker-machine env default)" ### or your machine name.
    

    and try to run the tests manually inside the container (docker exec -ti container-name /bin/bash) to see what is going wrong there.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.