Quite common use-case with docker-compose:
version: '2'
services:
web:
build: ./myapp
When I want to deploy a new version I just pull the latest version of my code then make a docker-compose up --build -d
.
Works almost perfectly except each time I make an update it erases my past logs accessible using docker-compose logs
. I understand why docker behaves that way (even if docker-compose recreates a container with the same name it's still a brand new container, so it's quite logical logs get flushed). Still, it's really not practical.
Any one has a solution for that ? Preferably one that does not involve modifying images or using volumes to store logs. (Because that should be the whole point of docker logs, not having to worry about that).
I think your best bet is to use one of the Logging Driver options described on the Docker docs: https://docs.docker.com/engine/admin/logging/overview/
If this isn't a workable solution, can you give me a little more context for your goals and obstacles?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With