How can I both tail and grep Docker logs? I've tried the following:
sudo docker logs -f my_container | grep foo
This should tail all lines with foo from the container's logs, but instead shows everything.
How can I both tail and grep Docker logs? I've tried the following:
sudo docker logs -f my_container | grep foo
This should tail all lines with foo from the container's logs, but instead shows everything.
Here's what I did:
docker logs -f my_container &> log.logtails all the containers logs while also outputting to filelog.log. In parallel, which is what the&by itself does,tail -f log.log | grep footails that file and greps, which a common way to grep tailed output.The downside is that file
log.logis created, but there was no other way to do this.