We are running Century Link's Watchtower container. This allows us to have a watch a docker registry and download new images when they are created. When watchtower finds a new image it runs docker rmi
which deletes the old container. With that the old logs go with it.
Is there a way without using a logging service to retain the logs when docker does it's clean up?
You can retain your logs by either logging to shared data volume :
Say you have logs of container in /apps/logs location
docker volume create logs
docker run -v logs:/apps/logs <image>
Or you can directly log onto host directory
docker run -v /apps/logs:/apps/logs <image>
So, by these methods you can retain your logs even after old containers and images are deleted.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.