0

Context*

I forgot to pass the "--tail" options to the "docker logs" command when inspecting a running container. The affected container dumps tens of millions of logs.

The command line was something like:

  $ docker logs contianer01 | vim -

When executing such line my server becomes completely unresponsive for minutes due to exhaution of free RAM memory with peak loads beyond 60x100%. I loose control of the terminal and ssh connection fails.

Question: Is it any tunning in docker to "fail fast" and forbid such big log outputs in first place (maybe tunning ulimits for the docker daemon in some config file)

NOTE: Probably "ulimit", "resource-control" and "linux" tags must be added to this question but I have not enough "reputation".

1
  • For the record, what eats space here is vim, you wouldn't have a problem with less for exemple which would stream the output and not load it entirely in memory. – Tensibai Dec 15 '20 at 20:27
1

One way to limit docker logs is to specify limits in docker daemon's config file.

You can put this in /etc/docker/daemon.json

{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3" 
  }
}

and then restart your docker daemon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.