Search code examples
dockerloggingdocker-composeexit

Can't exit from docker-compose logs -f [container name]


I can successfully follow the logs of a container by entering docker-compose -f [containerName] (where containerName is the name of the docker container I want to follow. Once I'm following the logs, though, I'm unable to exit by pressing control + c, control + z , q, bye or any of the normal exit commands. The log just continues


Solution

  • Press Ctrl+C two or three times, which will usually stop the logging process with:

    ERRO[0004] got 3 SIGTERM/SIGINTs, forcing shutdown

    As of November 2021, there is still a docker-compose bug that prevents closing the logs when using the --follow (-f) flag with a single Ctrl+C.

    See GitHub project issue: CTRL-C does not end compose logs -f #8880