Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker-compose replays past output on container reboot

It appears that docker-compose replays captured output on container re-launch. This is against expectation, and is misleading about what my container is actually doing. Can this be disabled?

For instance,

  • I have a simple service that logs and exits w/ code 0.
  • In docker-compose.yml, i have restart: always set.

When running docker-compose up, each time the logging container comes back up after existing, I see all previous output relogged, plus any new additions from the current run.

Here's an easy to run example.

  • clone, cd <project>/fluentd, docker-compose build, & docker-compose up

I'm using docker-compose version 1.16.1, build 6d1ac21 on OSX.

Tips would be great!

like image 459
cdaringe Avatar asked Nov 07 '22 14:11

cdaringe


1 Answers

This appears to be an open issue with Docker, where it's replaying logs on up. A workaround is mentioned here:

alias docker-logs-truncate="docker-machine ssh default -- 'sudo find /var/lib/docker/containers/ -iname \"*json.log\"|xargs -I{} sudo dd if=/dev/null of={}'"

like image 174
mahemoff Avatar answered Nov 15 '22 07:11

mahemoff