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

  • Symfony environment in Docker container
  • Docker error with pip version while building new image
  • issue with Docker registry having ngnix authentication
  • How to optimize performance for a docker container?
  • Restricted Image Pull rights on Amazon ECR
  • Rancher and elasticsearch Nest
  • 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 !!!

  • Deployment of web application delegating to the fixed openam sso url
  • Using a unique-hosted data volume containers with v3 in swarm
  • Simple docker command does not work: x509: cannot validate certificate
  • set hostname service docker swarm
  • Does “ports” on docker-compose.yml have the same effect as EXPOSE on Dockerfile?
  • etcd api on CoreOS - setting ip address configurations remotely
  • 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.