docker-compose
docker-compose copied to clipboard
Add a way to view logs
I'm using this project to create a CLI that wraps some docker-compose stuff to spin up a local environment. It would be nice to be able to have a command that would stream docker-compose logs.
Would this be possible, or is there an alternative you recommend?
@devshawn Thanks for using docker-compose. Would you like to implement this feature and send a PR or do you expect it to be available eventually?
I'd be happy to take a stab at it if no one has time for it. It'd be nice to have the option to view logs to the current point as well as streaming it. docker-compose logs vs docker-compose logs --follow.
The latter means the process wouldn't end until the user stops/kills it, but in my case, that's useful. What are your thoughts on this? It appears most commands here run in -d without any user interaction.
Makes sense to me, get going 👍
@devshawn is #38 what you're looking for?
@AlexZeitler - Yes, I believe this would work great! Sorry for not responding, I haven't had time for the project I'm using this for in the past couple of weeks. 👍
@devshawn Great to hear! I've just released it on npm (v0.12.0).
Please let me know if it works for you.
@AlexZeitler I've read through the code and noticed that --follow flag will probably not work when one asks for a container that simply does not end. After all, promises are only resolved when process ends, which practically means there is no way to actually "follow" logs for a running process and - especially - multiple containers.
There is a possibility to handle following logs (or uping a container without actually detaching) if instead of working with a promise we would use JS generators and/or EventEmitters. This can potentially lead to reduction in memory usage, since there might no longer be need to store process output in a variable, but instead rely on user handling our event emission or reading directly from subprocess stdout/stderr (if yielded from generator at some point). This would constitute a major BC tho. WDYT?
btw, do you have any slack or gitter channel?
I've added #60 as work-in-progress / proof-of-concept.
@Steveb-p I created a Slack workspace at https://pdmlab-oss.slack.com.
Just drop me a line with your email address at [email protected] so I can invite you.