Skip to content

Add read-only buffer support and smart streaming for Docker logs#252

Merged
Silex merged 2 commits intoSilex:mainfrom
DamianB-BitFlipper:main
Jan 26, 2026
Merged

Add read-only buffer support and smart streaming for Docker logs#252
Silex merged 2 commits intoSilex:mainfrom
DamianB-BitFlipper:main

Conversation

@DamianB-BitFlipper
Copy link
Contributor

@DamianB-BitFlipper DamianB-BitFlipper commented Jan 24, 2026

Problem Statement

When viewing the logs of a container that had very long outputs (in non-follow mode), it would take 30s for the logs to fully populate the buffer. That in comparison with running it in my cli which takes 0.2 seconds. So I decided to dig in and fix this issue.

Solution

  • create two different modes for populating output buffers, streaming and non-streaming
  • docker logs now behaves intelligently: read-only streams with -f, otherwise collects output first and displays in a buffer all at once. This is much faster.
  • docker attach uses streaming mode as expected for interactive use
  • Output is properly rendered with ANSI colors and stripped of carriage returns

Changes

docker-process.el:

  • Add readonly parameter to docker-run-async-with-buffer functions
  • Create docker-process-filter-readonly for read-only streaming buffers with ANSI color support and CR stripping
  • Update shell and vterm buffer functions to support readonly mode (vterm falls back to shell when readonly)

docker-core.el:

  • Split buffer actions into docker-generic-action-with-buffer-stream (streaming) and docker-generic-action-with-buffer (collect-then-display)
  • The collect-then-display variant waits for command completion before showing output in a special-mode buffer

docker-container.el:

  • Add docker-container-logs-action that intelligently chooses streaming vs collected output based on -f flag
  • Update docker-container-attach to use streaming buffer for interactive use
  • Update docker-container-logs to use the new smart logs action

@Silex
Copy link
Owner

Silex commented Jan 26, 2026

What a beautiful PR 👍

Thanks.

@Silex Silex merged commit 405bb9a into Silex:main Jan 26, 2026
16 checks passed
@DamianB-BitFlipper
Copy link
Contributor Author

🎉

@Silex
Copy link
Owner

Silex commented Jan 27, 2026

For the record I refactored your changes into explicit interactive/non-interactive in 9cb4349

@DamianB-BitFlipper
Copy link
Contributor Author

Makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants