Docker to store an application(service) logs in a folder and purge them on a timely basis

I just had a query of storing the logs of a service/application in a separate folder and purge them frequently.

We use Docker in Webmin server to deploy our Spring boot Application. we would like to achieve the above to prevent the space mess in webmin server

  • lxc-kill: failed to get the init pid
  • Delete Docker from Docker?
  • Injecting the elastic beanstalk server URL into the node.js configuration using Docker
  • Building a docker image for a node.js app fails behind proxy
  • disable firewalld/iptables in centos7 minimal version
  • Docker machine is active, but shown as aborted in Virtual Box
  • Below is a sample command we use to build and run the service,

    docker build -t application-service:latest ./application-service
    docker run -p 1070:1070 -m 128m -d application-service
    

    I used “-m” for memory allocation of a service And, I just wonder, is there any key to store the logs of the application in different path and any other things which i can do in docker or webmin server to purge the logs in that particular location

    Thanks in advance !!! Awaiting for a suggestion !!!

  • docker client daemon access remote swarm `1.12.1` manager
  • Elastic Beanstalk with Docker deployment failure
  • Docker - How to check if curl command inside Dockerfile had response code 200
  • run netflixoss docker on windows 8.1
  • Selenium Test Execution in Docker with UI
  • Installing ssh-keyscan on Alpine linux?
  • One Solution collect form web for “Docker to store an application(service) logs in a folder and purge them on a timely basis”

    Docker has a number ways of handling the container logs. You can read about them here.

    All you need is to provide the logging driver you need, while you call docker run with the --log-driver flag specifying the driver and it’s configuration.

    One more possible solution is to use mounted volumes and configure your service, which is running within container, to store it’s logs into the folder, which should be mounted. In that case, you will have access to the logs in your host-machine.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.