AnarKi
AnarKi

Reputation: 997

Why does docker-compose print the container output non sequentially

I have 4 containers that I run using a docker-compose file. one of these containers "orchestrates" the other containers work and therefore calls the other containers for doing some tasks.

My problem is that the output of this "orchestrater" container is always displayed once all the other containers have finished and therefore have finished displayed their own outputs.

For the sake of example, this is how the workflow of the containers can look like:

  1. orchestrater container
  2. Container 2
  3. orchestrater container
  4. Container 3
  5. orchestrater container
  6. Container 4
  7. orchestrater container

Is there a way to enforce that the outputs are displayed in sequence ?

Upvotes: 4

Views: 603

Answers (1)

Nick Suslov
Nick Suslov

Reputation: 124

When you run docker-compose in attached mod (without -d flag that run containers in detached mode), you will get output from all containers in real time, and there is no way to range outputs.

Possible solution can be to disable all logs from containers 2,3,4 with settings in docker-compose file:

logging:
    driver: none

In this case you will get outputs only for orchestrater container. Other way to split this containers to different docker-compose files. One will be with orchestrater container and second with other containers. You can run docker-compose with defining files:

docker-compose up -f orchestrater_docker_compose.yml
docker-compose up -f services_docker_compose.yml

Upvotes: 1

Related Questions