Skip to content

logs doesn't exit if the container is already stopped #1866

@dnephin

Description

@dnephin

Related to #1858 (cc @aanand, @mnowster since this just came up)

If we attach the log printer to a container that has already exited, it never gets the "end of log" condition and docker-compose logs doesn't exist (the same is true for up).

In a way, this is related to the problem described in #1115, where logs for containers created by scale are not picked up.

I think we can fix both of those issues by adjusting the way we find containers to log. Instead of sending in a list of containers, we can do something like this:

  1. start a thread which tails events (related to Proposal: docker-compose events #1510)
  2. when it receives a "create" event that matches the service name we want to print logs for, create a new thread to consume logs for that container
  3. (in the case of up) start the containers
  4. proceed with log tailing until all containers have exited (which will change the exit condition as well I think)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions