Question

How do I persist Docker container logs on my Droplet?

I’m running a few containers on a DigitalOcean Droplet and using docker logs to check output.

The issue is that logs disappear when containers are restarted. What’s the best way to persist logs or send them somewhere reliable so I don’t lose them after restarts or reboots?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
March 25, 2025

Hey there 👋

By default, Docker uses the json-file logging driver, which stores logs locally, but they can get wiped on container restart depending on your settings.

To persist logs, you can:

  • Mount a volume to /var/lib/docker/containers (not ideal)

  • Use a logging driver like syslog, journald, or a remote option like fluentd or Papertrail

  • Or redirect logs inside your app to a mounted volume or external service

If you’re using App Platform, you can also forward logs to Papertrail directly from the dashboard:

https://docs.digitalocean.com/products/app-platform/how-to/forward-logs/

- Bobby

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.