What is `mode: non-blocking` for log drivers?
AdvancedProductionResource Limits, Health & Reliability
Answer
By default log writes are blocking: if the driver (e.g., awslogs, syslog over TCP) stalls, the app's stdout write blocks and the service hangs. non-blocking uses an in-memory ring buffer (max-buffer-size, default 1m) and drops messages when it fills.
docker run --log-driver=awslogs --log-opt awslogs-group=app --log-opt mode=non-blocking --log-opt max-buffer-size=4m app
More on Resource Limits, Health & Reliability
How do you set memory and CPU limits, and what happens when they are exceeded?BeginnerWhat is the difference between `--cpus`, `--cpu-shares` and `--cpuset-cpus`?BeginnerWhat does `--memory-reservation` do?AdvancedHow do you diagnose an OOM-killed container?IntermediateWhy do JVM and Node services in containers need explicit memory flags?IntermediateWhat is CPU throttling, and how do you detect it?Advanced