containerd / nerdctl

contaiNERD CTL - Docker-compatible CLI for containerd, with support for Compose, Rootless, eStargz, OCIcrypt, IPFS, ...
Apache License 2.0
7.96k stars 594 forks source link

Add log rotation and log size limits to the nerdctl.toml configuration file #3317

Open niroshea opened 1 month ago

niroshea commented 1 month ago

What is the problem you're trying to solve

When I run the container with the following command, it works fine.

nerdctl run --log-opt=max-size=100m --log-opt=max-file=5 -d nginx

But I can't specify the --log-opt option when I need to start multiple containers with the nerdctl compose command.

nerdctl compose --log-opt=max-size=100m --log-opt=max-file=5 -f docker-compose.yaml up -d

The error message is as follows: FATA[0000] unknown flag: --log-opt

Is it possible to add options such as log-opt.max-size log-opt.max-file to the nerdctl.toml configuration file so that nerdctl's logging management can take effect globally, avoiding the need to specify parameters on the command line each time?

Describe the solution you'd like

Is it possible to add options such as log-opt.max-size log-opt.max-file to the nerdctl.toml configuration file so that nerdctl's logging management can take effect globally, avoiding the need to specify parameters on the command line each time?

Additional context

No response

yankay commented 1 week ago

niroshea

HI @niroshea

The log can be configured in the compose file like: https://docs.docker.com/reference/compose-file/services/#logging

And the nerdctl needs to keep the compatibility with docker.