docker/cli ยท error

requested load from stdin, but stdin is empty

Error message

requested load from stdin, but stdin is empty

What it means

docker image load reads a tar archive from stdin when no --input/-i flag is given. In runLoad (cli/command/image/load.go:63-64), if the input flag is empty and stdin is an interactive terminal (dockerCli.In().IsTerminal()), the CLI refuses to proceed rather than block forever waiting for tar bytes that will never arrive. It is a guard against the command hanging indefinitely on an interactive TTY.

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 e9452d6e78)

Solutions

  1. Pass the archive with the flag: docker load -i myimage.tar
  2. Or redirect/pipe the tar into stdin: docker load < myimage.tar, or gunzip -c img.tar.gz | docker load
  3. In scripts, verify the upstream command actually produces the tar stream before piping to docker load

Example fix

# before
docker load myimage.tar   # positional arg ignored, stdin is a TTY -> error
# after
docker load -i myimage.tar
# or
docker load < myimage.tar

When it happens

Trigger: Running `docker load` (or `docker image load`) in an interactive shell with no -i/--input flag and nothing piped or redirected into stdin, so stdin is a terminal device. Any invocation where opts.input == "" and IsTerminal() returns true.

Common situations: Typing `docker load myimage.tar` and forgetting the -i flag (the positional argument is ignored; '-' as stdin is not yet supported per the TODO in the code); running docker load from a script or CI step where the expected pipe/redirect was dropped; alias or wrapper scripts that swallow the redirection.

Related errors


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/614fc777bfedbfbc.json. Report an issue: GitHub.