cli icon indicating copy to clipboard operation
cli copied to clipboard

Add --clear flag to docker logs command

Open Goal651 opened this issue 4 months ago • 0 comments

Description

Problem

Docker logs can grow very large, making it hard to view recent entries without scrolling.

Solution

Add a --clear flag to docker logs that:

  • Prompts for confirmation and truncates log files for stopped containers (permanent, requires root).

Use Cases

  • Quick viewing of logs without old output cluttering the screen.
  • Managing large log files on disk.

Implementation

  • Log truncation uses os.Truncate with root check.
  • Includes unit tests.

Goal651 avatar Oct 29 '25 07:10 Goal651