Skip to content

painc: runtime error when credential helper is a Docker image #2954

Description

@rakheshster

Description

I wanted to try docker-credential-pass on my Raspberry Pi, and rather than compile it for arm64 I thought I'd make a container out of this and try running that it. So I created the container and made a script called /usr/local/bin/docker-credential-pass (which is in my $PATH) with the following:

#!/bin/sh

docker run --rm --name docker-credential-pass -v $HOME/.password-store:/root/.password-store rakheshster/docker-credential-pass:latest $@

All it does is run this container that has the compiled docker-credential-pass as its entry point and mount the .password-store so it can be accessed. If I make this script executable and run it, it does work:

$ docker-credential-pass
Usage: /bin/docker-credential-pass <store|get|erase|list|version>

$ docker-credential-pass list
{"https://index.docker.io/v1/":"rakheshster"}

However, when I set my .docker/config.json file to use pass as credsStore it errors upon a docker login:

$ docker login
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x555749fba8]

goroutine 1 [running]:
github.com/docker/cli/cli/command.ConfigureAuth(0x5558d118a0, 0x40003de9c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5558c80801, 0x40003ac010, 0x5556f15400)
        /go/src/github.com/docker/cli/cli/command/registry.go:128 +0x30
github.com/docker/cli/cli/command/registry.runLogin(0x5558d118a0, 0x40003de9c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x555748d36c, ...)
        /go/src/github.com/docker/cli/cli/command/registry/login.go:123 +0x180
github.com/docker/cli/cli/command/registry.NewLoginCommand.func1(0x400035e840, 0x5559d14110, 0x0, 0x0, 0x0, 0x0)
        /go/src/github.com/docker/cli/cli/command/registry/login.go:45 +0xa8
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).execute(0x400035e840, 0x4000400f10, 0x0, 0x0, 0x400035e840, 0x4000400f10)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:850 +0x314
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x400024a2c0, 0x4000400f10, 0x1, 0x1)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:958 +0x250
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(...)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:895
main.runDocker(0x40003de9c0, 0x5558c83560, 0x40000da010)
        /go/src/github.com/docker/cli/cmd/docker/docker.go:287 +0x16c
main.main()
        /go/src/github.com/docker/cli/cmd/docker/docker.go:298 +0xcc

If I compile docker-credential-pass and replace the script with the binary the same docker login command runs successfully.

Am I doing something wrong here? Is it not possible to run a credential helper this way?

Steps to reproduce the issue:

  1. Ensure you don't have docker-credential-pass installed; if so make it non-executable or move it out of $PATH
  2. Create a file /usr/local/bin/docker-credential-pass with the contents as above, make it executable
  3. In $HOME/.docker/config.json set credsStore to be pass. Here's my file:
{
        "auths": {
                "https://index.docker.io/v1/": {}
        },
        "credsStore": "pass"
}
  1. Try docker login.

Describe the results you received:
Already pasted above

Describe the results you expected:
I would have expected it to work

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

I am running the following version:

Client: Docker Engine - Community
 Version:           20.10.2
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        2291f61
 Built:             Mon Dec 28 16:18:36 2020
 OS/Arch:           linux/arm64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.2
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8891c58
  Built:            Mon Dec 28 16:16:39 2020
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker info:

$ docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)

Server:
 Containers: 2
  Running: 1
  Paused: 0
  Stopped: 1
 Images: 36
 Server Version: 20.10.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.3-v8+
 Operating System: Debian GNU/Linux 10 (buster)
 OSType: linux
 Architecture: aarch64
 CPUs: 4
 Total Memory: 7.629GiB
 Name: pi
 ID: 5UHV:K25F:V56H:GIIV:4WXJ:HX3R:27UO:25EP:VNJN:55YL:IIAY:VVZZ
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory TCP limit support
WARNING: No oom kill disable support
WARNING: No blkio weight support
WARNING: No blkio weight_device support

Additional environment details (AWS, VirtualBox, physical, etc.):

A Raspberry Pi. 5.10.3-v8+ #1386 SMP PREEMPT Sun Dec 27 14:09:57 GMT 2020 aarch64 GNU/Linux

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions