You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: container image save appends image references to stdout archive #1801
If possible, I've reproduced the issue using the 'main' branch of this project
Steps to reproduce
Build or use container from current main.
Save an image without --output, redirecting stdout to a tar file:
container image save alpine:latest > alpine.tar
Inspect the resulting archive with a tar/OCI consumer that expects the stream to end at the tar EOF markers.
The current implementation writes the archive bytes to stdout, then prints each saved image reference to stdout afterward:
Sources/ContainerCommands/Image/ImageSave.swift, lines 132-137: writes tar chunks to FileHandle.standardOutput
Sources/ContainerCommands/Image/ImageSave.swift, lines 141-144: calls print(reference) after the stdout archive path completes
Problem description
When container image save is used without --output, stdout is the archive stream. The command should emit only archive bytes on stdout so shell redirection and pipelines produce a valid OCI-compatible tar archive.
Currently, after writing the tar data to stdout, the command prints image references to stdout. That appends text bytes after the archive stream, so a command such as:
container image save alpine:latest > alpine.tar
creates an archive with trailing non-archive output. container image load may tolerate that trailing data, so the existing stdin/stdout integration test can pass while other tar or OCI tooling rejects or warns about the archive. Status/reference output for the stdout mode should go to stderr/logging, or be suppressed when stdout is carrying the archive.
Environment
- OS: macOS 26.5.1 (25F80)
- Xcode: Full Xcode is not selected locally; active developer directory is /Library/Developer/CommandLineTools. Swift reports Apple Swift 6.3.2 targeting arm64-apple-macosx26.0.
- Container: container CLI version 1.0.0-15-g1d70dd6 (build: debug, commit: 1d70dd6)
Activity
Route `container image save` reference list to stderr in stdout mode (a…
Route `container image save` reference list to stderr in stdout mode (a…
Route `container image save` reference list to stderr in stdout mode (a…