• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Mister PKI

SSL Certificates * SSL Tools * Certificate Decoder

  • PKI Training
  • OpenSSL
  • Keytool
  • PKI Tools
    • Apereo CAS
    • SAML
    • OpenID Connect
  • Get expert help

Docker log file size

September 9, 2024 by Mister PKI Leave a Comment

The purpose of this article is to explore the reasons why the docker log file size will increase and could potentially fill up your disk space in a short amount of time. If you have a host machine running Docker with log monitoring and/or log rotation in place, you may still fill up your disk space if you are not careful.

Docker stores a container log in the following directory location:

/var/lib/docker/containers/CONTAINER_ID/CONTAINER_ID-json.log

The log will continue to grow with output from standard out.

Max docker log file size

Docker run

To provide a max file size for this log you may append the following option to your docker run command:

--log-opt max-size=50m 
--log-opt max-file=5

Where max-size=50m is the size of the file, which should be set to the file size of your choice and max-file=5 is the max number of log files created.

Docker compose

Alternatively, if you are using docker compose instead of the docker run command you can configure the max log file size for your docker container in the docker compose script.

logging:
      driver: "json-file"
      options:
        max-size: 50m
        max-file: 5

Where driver is the type of driver and max-size is the maximum file size of your docker log file. max-file is the maximum number of files created.

Conclusion – Docker file log size

This article has demonstrated a couple of different methods for limiting the max size of log files generated by your docker containers. Let us know in the comments if you have any questions or would like to see more examples of how to reduce the size of your docker log files.

Read more of our articles on docker.

docker

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Popular Posts

PKCS12

openssl s_client

Keytool

Keytool list

ECDSA vs RSA

OpenSSL

PKCS7

Certificate Decoder

PKI for DevOps Engineers – Free Training Series

PKI for DevOps Training Hub

Lesson 1 – How TLS and PKI Work

Lesson 2 – Understanding X.509 Certificates

Lesson 3 – Certificate Chains Explained

Lesson 4 – Debug TLS with OpenSSL

Lesson 5 – Verify Certificate Chains

Lesson 6 – Creating CSRs with OpenSSL

Lesson 7 – Working with PKCS12 Certificates

Lesson 8 – Java Keystores and keytool

Lesson 9 – Certificate Expiration Monitoring

Lesson 10 – Automating Certificate Renewal

Lesson 11 – Common TLS Errors

Lesson 12 – PKI Architecture for DevOps

Recent Posts

  • Apache mod_auth_cas: Protect Web Applications with Apereo CAS and Docker
  • Apache mod_auth_mellon: Configure SAML SSO & Docker
  • Configure OpenID Connect (OIDC) in Apereo CAS 7.3 and 8
  • Certificate Ownership Is an Operating Model Problem, Not a Tooling Problem
  • OpenSSL dgst: Create Checksums and Verify Digital Signatures

Footer

  • Twitter
  • YouTube
Mister PKI

Practical security engineering for the systems that establish trust.

Learn OpenSSL Keytool Free training
Work together PKI consulting CAS consulting Sponsored contributions
Site About Support Mister PKI Cookie policy Search
© 2026 Mister PKI Secure systems. Clear guidance.