Skip to content

Getting logs from two Docker containers #58

Answered by PeterOsinski
iavor-k asked this question in Q&A
Discussion options

You must be logged in to vote

The reason you can't enter multiple log forwarding commands in the same terminal is because docker logs --follow is a "blocking" operation - it continuously streams logs in real-time and keeps the process running. This is by design, as it needs to stay active to monitor and forward new log entries as they appear.

When you run:

docker logs my-container1 --follow --tail=10 | logdy forward 8551

The terminal stays "busy" because:

  1. The --follow flag tells Docker to continuously watch for new logs
  2. The pipe (|) streams these logs to logdy in real-time
  3. logdy needs to keep running to receive and forward these logs to its specified port

This is why you need separate terminals/tabs - each streaming…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by PeterOsinski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants