How to fail loudly during docker-compose up -d?

Using docker-compose up -d, when one of my containers fails to start (i.e. the RUN command exits with an error code), it fails quietly – How can I make it fail loudly?

(Am I thinking about this the right way? My ultimate goal is using Docker for my development environment. I’d like to be able to spin up my environment and be informed of errors right away. I’d like to stay to Docker’s true path as much as possible, and am hesitant to depend on additional tools like screen/tmux)

  • How to alter the official mongo docker for authentication and data separation?
  • Folder permissions when running Symfony in Docker environment
  • Self hosted Drone CI doesn't synchronize my commits with Github
  • How to remove docker installed using wget? [closed]
  • How to evaluate the CPU and Mem usage for speccific command/docker in linux?
  • Docker running test with nodejs and volume
  • Arbitrary Code Execution with Docker
  • Setting .htcaccess in an external volume for Docker not working
  • Noob FED tries to run MeanJS app on docker port mapping throws error
  • Tag docker image after bitbucket Webhook
  • Docker volume command line option mistaking files for directories
  • Docker overwrites files?
  • 2 Solutions collect form web for “How to fail loudly during docker-compose up -d?”

    Since you are running it detached (-d), docker-compose only spawns the containers and exits, without monitoring for any issues. If you run the containers in the foreground with:

    docker-compose up --abort-on-container-exit

    That should give you a pretty clear error on any container problems. Otherwise, I’d recommend looking into some of the other more advanced schedulers that monitor the running containers to recover from failures (e.g. Universal Control Plane or Kubernetes).

    Update: If you want to script something outside of the docker-compose up -d, you can do a

    docker events -f "container=${compose_prefix}_" -f "event=die"

    and if anything gets output there, you had a container go down. There’s also docker-compose events | grep "container die".

    As shown in compose/cli/, docker-compose is supposed to fail on (Dockerfile) build:

    except BuildError as e:
            log.error("Service '%s' failed to build: %s" % (, e.reason))

    Since -d (Detached mode, which runs containers in the background) is incompatible with --abort-on-container-exit, a “docker way” would be to:

    • wrap the docker compose up -d in a script
    • add to that script a docker-compose logs), parsing for any error, and loudly exiting if any error message is found..
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.