We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No response
When a ~/.docker/config.json file has an empty auths member, the docker.NewAuthConfigurationsFromDockerCfg() function returns a misleading error.
~/.docker/config.json
auths
docker.NewAuthConfigurationsFromDockerCfg()
Given this main.go:
main.go
package main import ( "fmt" "log" "github.com/ory/dockertest/v3/docker" ) func main() { authConfigs, err := docker.NewAuthConfigurationsFromDockerCfg() if err != nil { log.Fatal(err) } fmt.Printf("auth configurations: %#v\n", authConfigs) }
I see this error logged:
# go run main.go 2023/11/11 12:35:31 open /Users/tim/.dockercfg: no such file or directory exit status 1
My Docker ~/.docker/config.json looks like this:
{ "auths": {}, "credHelpers": { "asia.gcr.io": "gcloud", "eu.gcr.io": "gcloud", "gcr.io": "gcloud", "marketplace.gcr.io": "gcloud", "staging-k8s.gcr.io": "gcloud", "us.gcr.io": "gcloud" }, "credsStore": "desktop" }
v3.10.0
macOS
None
It looks like in the config.json parsing, if the auths object has no members:
config.json
dockertest/docker/auth.go
Lines 119 to 121 in f37306e
then an assumption is made that the config file will be a map[string]dockerConfig:
map[string]dockerConfig
Lines 124 to 127 in f37306e
The structure of my config.json doesn't match that. My config.json was recently updated after a docker logout ghcr.io.
docker logout ghcr.io
# docker version Client: Cloud integration: v1.0.29 Version: 20.10.21 API version: 1.41 Go version: go1.18.7 Git commit: baeda1f Built: Tue Oct 25 18:01:18 2022 OS/Arch: darwin/arm64 Context: default Experimental: true Server: Docker Desktop 4.15.0 (93002) Engine: Version: 20.10.21 API version: 1.41 (minimum version 1.12) Go version: go1.18.7 Git commit: 3056208 Built: Tue Oct 25 17:59:41 2022 OS/Arch: linux/arm64 Experimental: false containerd: Version: 1.6.10 GitCommit: 770bd0108c32f3fb5c73ae1264f7e503fe7b2661 runc: Version: 1.1.4 GitCommit: v1.1.4-0-g5fd4c4d docker-init: Version: 0.19.0 GitCommit: de40ad0
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Preflight checklist
Ory Network Project
No response
Describe the bug
When a
~/.docker/config.json
file has an emptyauths
member, thedocker.NewAuthConfigurationsFromDockerCfg()
function returns a misleading error.Reproducing the bug
Given this
main.go
:I see this error logged:
My Docker
~/.docker/config.json
looks like this:Relevant log output
No response
Relevant configuration
No response
Version
v3.10.0
On which operating system are you observing this issue?
macOS
In which environment are you deploying?
None
Additional Context
It looks like in the
config.json
parsing, if theauths
object has no members:dockertest/docker/auth.go
Lines 119 to 121 in f37306e
then an assumption is made that the config file will be a
map[string]dockerConfig
:dockertest/docker/auth.go
Lines 124 to 127 in f37306e
The structure of my
config.json
doesn't match that. Myconfig.json
was recently updated after adocker logout ghcr.io
.The text was updated successfully, but these errors were encountered: