docker / for-linux

Docker Engine for Linux
https://docs.docker.com/engine/installation/
756 stars 85 forks source link

~/.docker/config.json prevented me from building an image #383

Open jukefr opened 6 years ago

jukefr commented 6 years ago

Expected behavior

Tried to run docker-compose build xxx on my Dockerfile. Expected an image build. I have used docker for a while and never had this problem.

Actual behavior

Errored out and told me :

Building xxx
Traceback (most recent call last):
  File "bin/docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 71, in main
  File "compose/cli/main.py", line 127, in perform_command
  File "compose/cli/main.py", line 282, in build
  File "compose/project.py", line 378, in build
  File "compose/service.py", line 1067, in build
  File "site-packages/docker/api/build.py", line 251, in build
  File "site-packages/docker/api/build.py", line 306, in _set_auth_headers
  File "site-packages/docker/auth.py", line 96, in resolve_authconfig
  File "site-packages/docker/auth.py", line 127, in _resolve_authconfig_credstore
  File "site-packages/dockerpycreds/store.py", line 25, in __init__
dockerpycreds.errors.InitializationError: docker-credential-secretservice not installed or not available in PATH
[13121] Failed to execute script docker-compose

Steps to reproduce the behavior

I had never even touched the config file, didn't know there was one. Here is the content it generated automagically

{
    "auths": {
        "https://index.docker.io/v1/": {}
    },
    "HttpHeaders": {
        "User-Agent": "Docker-Client/17.12.1-ce (linux)"
    },
    "credsStore": "secretservice"
}   

And when I ran the build it errored.

Output of docker version:

Client:
 Version:           18.06.0-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        0ffa825
 Built:             Wed Jul 18 19:09:54 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.0-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       0ffa825
  Built:            Wed Jul 18 19:07:56 2018
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker info:

Containers: 109
 Running: 9
 Paused: 0
 Stopped: 100
Images: 910
Server Version: 18.06.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: d64c661f1d51c48782c9cec8fda7604785f93587
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.17.10-041710-generic
Operating System: Ubuntu 18.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.56GiB
Name: nah
ID: nah
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

fix :

simply deleted ~/.docker/config.json

cpuguy83 commented 6 years ago

Is the build pulling a private image?

docker-credential-secretservice not installed or not available in PATH

This means that the credential helper for "secretservice" is not installed correctly. Please see https://docs.docker.com/engine/reference/commandline/login/#privileged-user-requirement for more details on credential stores.

Side note: presumably what you really want here is the credential helper for pass... but again just making an assumption here.

jukefr commented 6 years ago

I was pulling FROM php:7.2-apache so it should not even try to use any credentials

I never ran (or at least remember running) docker-login at any point in time...

cpuguy83 commented 6 years ago

Thanks! Seems like it may be trying to load unnecessarily then.

Q-back commented 4 years ago

I had the same issue when I switched from one private project where I was using gcloud to authenticate to another project where I'm using GITLAB_TOKEN to authenticate. I'm not good at docker/k8s yet but I guess this config file is created by using $ kubectx my_context, right? Maybe there should be a way to set clean context with kubectx..

ilude commented 4 years ago

Any news on this getting fixed? I'm having to remove ~/.docker/config.json daily and sometime hourly.

Server Version: 19.03.12 Don't use docker-login or GCloud

rjurney commented 4 years ago

This happened to me also. I removed the credHelpers entries under ~/.docker/config.json and it worked again. Thing is - I did not change anything so how did this start happening? I haven't used gcloud on this machine for a while.

ghost commented 4 years ago

Exactly the same behaviour as @rjurney Don't use docker-login am using gcloud but never with docker

It worked after removing ~/.docker/config.json

AuburnClaire commented 4 years ago

I commented out the credHelpers portion of ~/.docker/config.json; it worked. Like so: /,"credHelpers":{"gcr.io":"gcloud","us.gcr.io":"gcloud","eu.gcr.io":"gcloud","asia.gcr.io":"gcloud","staging-k8s.gcr.io":"gcloud","marketplace.gcr.io":"gcloud"} /

Worth noting, it was in the Docker-itself-main-folder, not the Docker subfolder in the program I was installing.

rjurney commented 4 years ago

This turned out to be a $PATH problem. gcloud was installed but fell out of the path when Anaconda Python's conda init command clobbered it in my ~/.profile. I suspect this is the root of the problem for most people.

To resolve, find where the gcloud executable is on your system.

sudo find / -iname gcloud

If it is found, gcloud is installed but isn't in your $PATH variable. Did you just install new software on this computer? Some packages alter your ~/.profile, ~/.bashrc, ~/.bash_profile or whatever file your non-bash shell uses to initialize your shell environment. Sometimes when they do this they accidentally remove directories from your $PATH variable.

Check your $PATH variable.

echo $PATH

Is the directory to gcloud there? If not, add it. Note we include the existing $PATH when we set a new one.

export PATH=$PATH:/path/to/gcloud

You can put this in your shell initialization file or figure out what broke your $PATH variable by examining them. Look for something that sets your path without using the $PATH variable to retain what is already there like this:

export PATH=/foo/bar:/use/local/foo/bar

This should fix the problem for most people :)

nicolasmafra commented 3 years ago

After I clicked "Reset to factory defaults" the problem never occurred again.

harmin-parra commented 1 year ago

I ran into this problem when i removed all containers (sudo docker rm xxx) and images (sudo docker rmi xxx)

I was forced to uninstall everything (docker, docker-desktop, docker-compose, etc), remove conf files (ex: ~/.docker) and reinstall everything again in order to get around this problem.