docker/cli · error
requested load from stdin, but stdin is empty
Error message
requested load from stdin, but stdin is empty
What it means
runLoad() defaults input to stdin. To avoid blocking forever waiting for data that will never arrive, it checks dockerCli.In().IsTerminal(): if no -i file was given and stdin is an interactive TTY (nothing piped), it errors immediately instead of hanging.
Solutions
- Pass an input file: `docker load -i image.tar`
- Redirect from a file: `docker load < image.tar`
- Pipe from a producer command so stdin is not a TTY
Example fix
// before docker load // after docker load -i image.tar // or docker load < image.tar
Defensive patterns
Strategy: validation
Validate before calling
if opts.input == "" && dockerCli.In().IsTerminal() {
return errors.New("no input: pass -i <file> or pipe a tar archive on stdin")
} Prevention
- Always use -i <file> in scripts and CI for `docker load`
- Redirect or pipe input rather than relying on an interactive stdin
- Guard wrapper scripts with `[ -t 0 ]` to detect a missing pipe before load
When it happens
Trigger: Running `docker load` interactively in a shell with no -i flag and no input redirection.
Common situations: Forgetting to redirect a previously saved tar; running the command manually expecting a file picker.
Related errors
- cowardly refusing to save to a terminal. Use the -o flag or…
- cowardly refusing to export to a terminal, specify a file…
- invalid argument: can't use stdin for both build context…
- --quiet is not yet supported with --tree
- --no-trunc is not yet supported with --tree
AI-assisted analysis of docker/cli@4f84911bfe (2026-08-07).
Data as JSON: /api/errors/614fc777bfedbfbc.
Report an issue: GitHub.
Appendix: source
Thrown at cli/command/image/load.go:64
flags.StringVarP(&opts.input, "input", "i", "", "Read from tar archive file, instead of STDIN")
flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Suppress the load output")
flags.StringSliceVar(&opts.platform, "platform", []string{}, `Load only the given platform(s). Formatted as a comma-separated list of "os[/arch[/variant]]" (e.g., "linux/amd64,linux/arm64/v8").`)
_ = flags.SetAnnotation("platform", "version", []string{"1.48"})
_ = cmd.RegisterFlagCompletionFunc("platform", completion.Platforms())
return cmd
}
func runLoad(ctx context.Context, dockerCli command.Cli, opts loadOptions) error {
var input io.Reader = dockerCli.In()
// TODO(thaJeztah): add support for "-" as STDIN to match other commands, possibly making it a required positional argument.
switch opts.input {
case "":
// To avoid getting stuck, verify that a tar file is given either in
// the input flag or through stdin and if not display an error message and exit.
if dockerCli.In().IsTerminal() {
return errors.New("requested load from stdin, but stdin is empty")
}
default:
// We use sequential.Open to use sequential file access on Windows, avoiding
// depleting the standby list un-necessarily. On Linux, this equates to a regular os.Open.
file, err := sequential.Open(opts.input)
if err != nil {
return err
}
defer func() { _ = file.Close() }()
input = file
}
var options []client.ImageLoadOption
if opts.quiet || !dockerCli.Out().IsTerminal() {
options = append(options, client.ImageLoadWithQuiet(true))
}
platformList := []ocispec.Platform{}View on GitHub (pinned to 4f84911bfe)