I'm trying to pipe json logs from docker into jq.
It works fine if I use:
docker logs container_id 2>&1 | jq '.'
But, if I try to tail it, it gets stuck.
docker logs -f container_id 2>&1 | jq '.'
While tailing by itself does work:
docker logs -f container_id 2>&1
What am I missing here?
docker logs container_idshows plain text data so it is useless to redirect it tojq. The log files are indeed internally stored as json and json files. The path to log file for a particular container can be retrieveddocker inspect container_id | grep LogPath. And the json can be continuously showed:tail -f logfile | jq .– Zaboj Campula Jan 30 '17 at 18:49