Vincenzo
Vincenzo

Reputation: 6358

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

I might have a bit of a messed Docker installation on my Mac.. At first I installed Docker desktop but then running it I learned that as I'm on an older Mac I had to install VirtualBox so I did following these steps:

  1. enable writing on the /usr/local/bin folder for user

    sudo chown -R $(whoami) /usr/local/bin

  2. install Docker-Machine

base=https://github.com/docker/machine/releases/download/v0.16.0 &&
  curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/usr/local/bin/docker-machine &&
  chmod +x /usr/local/bin/docker-machine
  1. install Xcode CLI..manually from dev account

  2. Install Home Brew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install Docker + wget ( Using Brew)

    brew install docker

    brew install wget

  2. Install bash completion scripts

base=https://raw.githubusercontent.com/docker/machine/v0.16.0
for i in docker-machine-prompt.bash docker-machine-wrapper.bash docker-machine.bash
do
    sudo wget "$base/contrib/completion/bash/${i}" -P /etc/bash_completion.d
done
  1. enable the docker-machine shell prompt

    echo 'PS1='[\u@\h \W$(__docker_machine_ps1)]\$ '' >> ~/.bashrc

  2. Install VirtualBox, ExtensionPack and SDK: https://www.virtualbox.org/wiki/Downloads

I now installed docker-compose (docker-compose version 1.29.2, build unknown) with home-brew but when running docker-compose up I get the following error:

docker.credentials.errors.InitializationError: docker-credential-desktop not installed or not available in PATH

which docker prints /usr/local/bin/docker.

Brew installations are in /usr/local/Cellar/docker/20.10.6 and /usr/local/Cellar/docker-compose/1.29.2. As I see there is also a home-brew for docker-machine should I install docker-machine via home-brew instead?

What can I check to make sure that I use the docker installations from home-brew and wipe/correct the installations made from steps above?

Upvotes: 125

Views: 136967

Answers (10)

Ctfrancia
Ctfrancia

Reputation: 1588

If you are getting here because you are trying to use aws sam and get this error with sam local invoke Then what made it work for me was deleting the credsStore key/val which is located in ~/.docker/config.json. Which I found in this github issue

Upvotes: 1

sixrandanes
sixrandanes

Reputation: 4427

sed -i 's/"credsStore"/"credStore"/g' ~/.docker/config.json

Check your ~/.docker/config.json and replace "credsStore" by "credStore"

{
  "stackOrchestrator" : "swarm",
  "experimental" : "disabled",
  "credStore" : "desktop"
}

Upvotes: 378

Zeek X
Zeek X

Reputation: 1

In my MacOS(terminal:zsh):

~/.zshrc:

export  http_proxy="http://192.168.31.164:1082"
export  https_proxy="http://192.168.31.164:1082" 

% source ~/.zshrc

Then, docker using my proxy anyway

Upvotes: 0

Dennis Nedry
Dennis Nedry

Reputation: 4748

My config stopped working after I've installed Docker Desktop which apparently added "credsStore": "desktop" to my ~/.docker/config.json.

Removing "credsStore": "desktop" fixed the issue as mentioned by various comments above.

Upvotes: 5

Ivan
Ivan

Reputation: 2868

In ~/.docker/config.json just change credsStore to credStore

Upvotes: 118

dysbulic
dysbulic

Reputation: 3105

As has been mentioned elsewhere, renaming credsStore to credStore just sets it to an invalid value and disables authorization.

I'm assuming my issue is because I have docker-ce installed & not docker-desktop. The solution I found was to build a credential helper from their repo.

I'm running a rootless install under Ubuntu, but some of the commands required root access, so I ended up running:

  • sudo systemctl start docker
  • sudo docker run --privileged --rm tonistiigi/binfmt --install all
  • sudo docker buildx create --use
  • git clone https://github.com/docker/docker-credential-helpers.git
  • cd docker-credential-helpers/
  • make secretservice # secretservice uses the dbus secrets manager
  • cp bin/build/docker-credential-secretservice ~/bin # ~/bin is on my $PATH
  • cd ~/.docker/
  • sed -e 's/"credsStore": "desktop"/"credsStore": "secretservice"/' config.json > config.json.new
  • mv config.json.new config.json

Upvotes: 1

Vincenzo
Vincenzo

Reputation: 6358

After a long googling I found out that the problem is with the config.json file. The "credsStore" : "docker-credential-desktop" is wrong one in :

{
  "credsStore" : "docker-credential-desktop",
  "stackOrchestrator" : "swarm",
  "experimental" : "disabled"
} 

changed the "credsStore" key value to "desktop" and compose now works as expected. Some pointed out that credsDstore typo was the problem and fixed it with credDstore, but in my case the value was the problem, it works both with "credsStore" : "desktop" and "credStore" : "desktop".

Hope it'll help others starting out with Docker. Cheers.

Upvotes: 32

Naeem Ilyas
Naeem Ilyas

Reputation: 29

If your are on WSL, try desktop.exe, instead of desktop. Because you will find that the program in /usr/bin/ is docker-credential-desktop.exe.

{
   "credsStore": "desktop.exe"
}

Upvotes: 1

3ch01c
3ch01c

Reputation: 2896

Since you're on a Mac, you could use docker-credential-osxkeychain instead.

  1. Install docker-credential-helper.

    brew install docker-credential-helper
    
  2. Verify docker-credential-osxkeychain is available.

    $ docker-credential-osxkeychain version
    0.6.4
    
  3. Set credsStore to osxkeychain in ~/.docker/config.json

    {
      "auths": {
        "https://index.docker.io/v1/": {}
      },
      "credsStore": "osxkeychain",
      "experimental": "enabled",
      "stackOrchestrator": "swarm"
    }
    
  4. Login to Docker Hub.

    $ docker login -u $USER
    Password: 
    Login Succeeded
    

Upvotes: 76

clayajohnson
clayajohnson

Reputation: 31

I ran into a similar issue using wsl2 on windows 10 while trying to locally invoke an aws lambda function. I was getting docker.credentials.errors.InitializationError: docker-credential-desktop not installed or not available in PATH when running sam build --use-container. Running which docker-credential-desktop showed no results

Upon further inspection I found that docker-credential-desktop.exe was in PATH however. After a quick google, it seems like enabling the wsl2 backend in Docker Desktop for Windows 10 symlinks wsl/docker-desktop/cli-tools/usr/bin/docker-credentials-desktop.exe to /usr/bin/docker-credential-desktop.exe. To fix this I simply removed the symlink and created a new one without .exe

To check the link and remove it:

user@device:~$ ls -l /usr/bin/docker-credential-desktop.exe
lrwxrwxrwx 1 root root 67 Jan  5 23:15 /usr/bin/docker-credential-desktop.exe -> /wsl/docker-desktop/cli-tools/usr/bin/docker-credential-desktop.exe
user@device:~$ sudo rm /usr/bin/docker-credential-desktop.exe

To create a new one without .exe and check it worked:

user@device:~$ sudo ln -s /wsl/docker-desktop/cli-tools/usr/bin/docker-credential-desktop.exe /usr/bin/docker-credential-desktop
user@device:~$ ls -l /usr/bin/docker-credential-desktop
lrwxrwxrwx 1 root root 67 Jan 12 14:22 /usr/bin/docker-credential-desktop -> /wsl/docker-desktop/cli-tools/usr/bin/docker-credential-desktop.exe

After that I sourced .bashrc to update PATH and the problem was resolved. I verified this with which docker-credential-desktop and it now shows the location specified in the symlink above.

Upvotes: 2

Related Questions