60. Log Rotation Size Limit Configuration
Beginner Mode
Start your terminal to use beginner mode.
Scenario
A container image myapp:logapp continuously writes logs to stdout. Without log rotation configured, Docker's log files grow unbounded, consuming disk space and potentially filling up the filesystem.
Task
Run a container from the myapp:logapp image with the name myapp_container, enable Docker's built-in log rotation, configure the maximum size for individual log files to 10MB, retain maximum up to 3 log files during rotation, and verify the container is running successfully.
Example
Multiple rotated log files, each ≤10MB
/var/lib/docker/containers/<id>/<id>-json.log: 8.5MB
/var/lib/docker/containers/<id>/<id>-json.log.1: 10MB
/var/lib/docker/containers/<id>/<id>-json.log.2: 10MB
...
Docker automatically rotates logs at 10MB threshold
Terminal requires a larger screen
Open this page on a desktop or tablet (≥ 768px) to launch the terminal and practice hands-on.
Linux Terminal Environment
Write and execute your solution in the terminal below.
Essential
Linux 0/29
AWS 0/10
Kubernetes 0/15
CI/CD 0/5
Networking 0/9
Need more practice in this area? Explore more questions →
DeliveryHero
Accenture
Coinbase
Adobe
EPAM
Twitch
Amazon
Kayak
Autodesk
Lyft
Revolut
RedHat
Bloomberg
Datadog
Palantir
TCS
HashiCorp
Google
DeutscheBank
GitHub
Apple
Cloudflare
Stripe
Microsoft
NVIDIA
GoDaddy
X
SAP
Spotify
Airbnb
Meta
Reddit
Yelp
Okta
Dropbox
Slack
ActivisionBlizzard
Zscaler
Uber
IBM
Robinhood
GitLab
Shopify
Samsung
Elastic
Twilio
Netflix
CrowdStrike
Ubisoft
Anthropic
Capital One
Splunk
Intel
AMD
Databricks