{"action":"created","issue":{"url":"https://api.github.com/repos/docker/compose/issues/1486","labels_url":"https://api.github.com/repos/docker/compose/issues/1486/labels{/name}","comments_url":"https://api.github.com/repos/docker/compose/issues/1486/comments","events_url":"https://api.github.com/repos/docker/compose/issues/1486/events","html_url":"https://github.com/docker/compose/issues/1486","id":82768878,"number":1486,"title":"Behavior of 'logs' following 'up -d' and 'up'","user":{"login":"iafilatov","id":5930446,"avatar_url":"https://avatars.githubusercontent.com/u/5930446?v=3","gravatar_id":"","url":"https://api.github.com/users/iafilatov","html_url":"https://github.com/iafilatov","followers_url":"https://api.github.com/users/iafilatov/followers","following_url":"https://api.github.com/users/iafilatov/following{/other_user}","gists_url":"https://api.github.com/users/iafilatov/gists{/gist_id}","starred_url":"https://api.github.com/users/iafilatov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iafilatov/subscriptions","organizations_url":"https://api.github.com/users/iafilatov/orgs","repos_url":"https://api.github.com/users/iafilatov/repos","events_url":"https://api.github.com/users/iafilatov/events{/privacy}","received_events_url":"https://api.github.com/users/iafilatov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-30T10:02:53Z","updated_at":"2015-05-30T14:17:43Z","closed_at":null,"body":"When you do 'up -d', the containers continue to work until their \"natural death\", i.e. are not killed if just one of them stops (like happens with 'up' without '-d' - #741). But 'logs' still detaches on each container's exit. I think 'logs' should remain attached until no more output can be expected from the containers - until they *all* have exited. This should be a reasonable kind of behavior for simple 'up' as well.\r\n\r\nAlso, if you do 'logs' *after* all containers have stopped, it remains attached forever (or until you Ctrl+C out of it). This seems pointless as there's nothing to wait for at this point. Besides, you might want to pipe the logs to a pager to examine them, for example, but it won't work so well.\r\n\r\nTo sum it up, when compose is showing logs, and a container exits, it should check the status of other containers and remain attached as long it sees that any of them are still running.\r\n\r\nTo keep current behavior of 'up', the other containers must be stopped *before* the log printer exits, which seems trickier, but perhaps it could be possible to just teach the printer one more exit behavior: \"exit if none running\" in addition to current \"exit on first stopped container\". Then use the former for 'logs' and the latter for 'up'."},"comment":{"url":"https://api.github.com/repos/docker/compose/issues/comments/107044125","html_url":"https://github.com/docker/compose/issues/1486#issuecomment-107044125","issue_url":"https://api.github.com/repos/docker/compose/issues/1486","id":107044125,"user":{"login":"dnephin","id":442180,"avatar_url":"https://avatars.githubusercontent.com/u/442180?v=3","gravatar_id":"","url":"https://api.github.com/users/dnephin","html_url":"https://github.com/dnephin","followers_url":"https://api.github.com/users/dnephin/followers","following_url":"https://api.github.com/users/dnephin/following{/other_user}","gists_url":"https://api.github.com/users/dnephin/gists{/gist_id}","starred_url":"https://api.github.com/users/dnephin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnephin/subscriptions","organizations_url":"https://api.github.com/users/dnephin/orgs","repos_url":"https://api.github.com/users/dnephin/repos","events_url":"https://api.github.com/users/dnephin/events{/privacy}","received_events_url":"https://api.github.com/users/dnephin/received_events","type":"User","site_admin":false},"created_at":"2015-05-30T14:17:43Z","updated_at":"2015-05-30T14:17:43Z","body":"I agree with the proposed `logs` behaviour. I think we should wait for all streams to exit when the containers are running, and exit immediately after printing the logs if the containers are stopped."}}