docker / docker/cli

Add --clear flag to docker logs command

Open
#6,587 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature status/0-triage
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the docker logs command and its existing unit tests; trace how logs for stopped containers are handled. Verify the confirmation prompt, root requirement, and os.Truncate behavior, then add unit tests covering --clear and log truncation.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.