Skip to content

Add --clear flag to docker logs command #6587

@Goal651

Description

@Goal651

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions