Skip to content

docker pull should not prompt for password when no TTY is attached #6136

@thaJeztah

Description

@thaJeztah
Member

Description

Depending on the registry, the /images/create endpoint used by docker pull (and equivalent for push) may return a 401 status, which triggers the CLI to try to authenticate before retrying the pull / push.

However, this may also trigger a prompt for the user to provide username/password (or a credentials-helper to do so).

We should detect whether a TTY is attached, and otherwise error

Reproduce

docker pull icr.io/my-ns/my-image:latest  < /dev/null

Login prior to pull:

Expected behavior

CLI should terminate directly with an error message that authentication is required but missing (or doesn't have the right scope), and print the registry's error response.

docker version

Client:
 Version:           28.2.2
 API version:       1.50
 Go version:        go1.24.3
 Git commit:        e6534b4
 Built:             Fri May 30 12:07:14 2025
 OS/Arch:           linux/arm64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          28.2.2
  API version:      1.50 (minimum version 1.24)
  Go version:       go1.24.3
  Git commit:       45873be
  Built:            Fri May 30 11:31:12 2025
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          v1.7.27
  GitCommit:        05044ec0a9a75232cad458027ca83437aae3f4da
 runc:
  Version:          1.2.6
  GitCommit:        v1.2.6-0-ge89a299
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

not relevant

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @thaJeztah

      Issue actions

        docker pull should not prompt for password when no TTY is attached · Issue #6136 · docker/cli