docker/cli · error

exec ID empty

Error message

exec ID empty

What it means

After `docker exec` calls the ExecCreate API, the daemon returns an exec instance ID that the CLI needs for the subsequent ExecStart call. If the response's ID field is empty, the CLI aborts with this error — it indicates a malformed or unexpected daemon response rather than a user mistake, since ExecCreate succeeded (no transport error) yet returned no usable ID.

Source

Thrown at cli/command/container/exec.go:118

	if _, err := apiClient.ContainerInspect(ctx, containerIDorName, client.ContainerInspectOptions{}); err != nil {
		return err
	}
	if !options.Detach {
		if err := dockerCLI.In().CheckTty(execOptions.AttachStdin, execOptions.TTY); err != nil {
			return err
		}
	}

	fillConsoleSize(execOptions, dockerCLI)

	response, err := apiClient.ExecCreate(ctx, containerIDorName, *execOptions)
	if err != nil {
		return err
	}

	execID := response.ID
	if execID == "" {
		return errors.New("exec ID empty")
	}

	if options.Detach {
		_, err := apiClient.ExecStart(ctx, execID, client.ExecStartOptions{
			Detach:      options.Detach,
			TTY:         execOptions.TTY,
			ConsoleSize: client.ConsoleSize{Height: execOptions.ConsoleSize.Height, Width: execOptions.ConsoleSize.Width},
		})
		return err
	}
	return interactiveExec(ctx, dockerCLI, execOptions, execID)
}

func fillConsoleSize(execOptions *client.ExecCreateOptions, dockerCli command.Cli) {
	if execOptions.TTY {
		height, width := dockerCli.Out().GetTtySize()
		execOptions.ConsoleSize = client.ConsoleSize{Height: height, Width: width}
	}

View on GitHub (pinned to e9452d6e78)

Solutions

  1. Check what the CLI is actually talking to: `docker version` and `echo $DOCKER_HOST` / `docker context ls` — bypass any proxy and connect to the daemon directly.
  2. Upgrade or fix the daemon/proxy so ExecCreate returns a valid Id field.
  3. Retry the exec after restarting the daemon if it is in a bad state; inspect daemon logs for the exec create request.

When it happens

Trigger: apiClient.ExecCreate succeeds but response.ID == "" — a daemon or proxy returning an empty/stripped JSON body, an API-version mismatch, or a non-Docker endpoint impersonating the Docker API.

Common situations: Buggy or incompatible Docker API proxies/socket gateways (e.g. socket-proxy setups that mangle responses); talking to a very old or non-conformant daemon implementation; middleware that rewrites API responses.

Related errors


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