Skip to main content

Size of logs for each Docker container

Published 1 min readMarkdown

Print the size of the log for each container by sorting it by size

sudo du -ch $(docker inspect --format='{{.LogPath}}' $(docker ps -qa)) | sort -h

Set default limited log size when creating new containers

On Linux

  • Path: /etc/docker/daemon.json

On Windows

  • Path: %USERPROFILE%\.docker\daemon.json
{
  "log-driver": "local",
  "log-opts": {
    "max-size": "10m"
  }
}

About the author

  • I am a dedicated software engineer with a deep passion for security and a commitment to developing robust and scalable solutions. With over three years of hands-on experience in the .NET ecosystem, I have built, maintained, and optimized various software applications, demonstrating my ability to adapt to diverse project needs. In addition to my expertise in .NET, I have six months of specialized experience working with Spring Boot and ReactJS, further broadening my skill set to include full-stack development and modern web technologies. My professional journey includes deploying small to medium-sized systems to cloud platforms and on-premises environments, where I have ensured reliability, scalability, and efficient resource utilization. This combination of skills and experience reflects my versatility and commitment to staying at the forefront of the ever-evolving tech landscape.

No comments yet. Be the first to comment.

More from this blog