Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save log files from docker container?

Tags:

docker

I have a weblogic container running on docker-machine( which is running on Windows 7 using docker toolbox) and want to save the logs from the container automatically to the windows machine.

I know that I can use the docker cp command but, instead of coping the logs every time to the windows machine, is there a better way to save the logs from the container to a folder on windows machine?

like image 720
beginner Avatar asked Mar 13 '17 19:03

beginner


1 Answers

See "Docker Logging Strategies", which illustrates different methods.
The recommended one is logging via the Docker Logging Driver.
See more at "Configure logging drivers"

As shown in "Better ways of handling logging in containers", you can then link the log folder with an host folder through a data volume container.

# docker run -ti -v /dev/log:/dev/log fedora sh
like image 92
VonC Avatar answered Oct 21 '22 07:10

VonC