Fix issue docker-credential-desktop not installed or not available in PATH on Mac

  sonic0002        2020-06-23 03:25:16       15,722        0    

Sometimes you may encounter below issue while running docker-compose on MacOS.

Traceback (most recent call last):
  File "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 1085, in up
  File "compose/cli/main.py", line 1081, in up
  File "compose/project.py", line 527, in up
  File "compose/service.py", line 354, in ensure_image_exists
  File "compose/service.py", line 1222, in pull
  File "compose/progress_stream.py", line 102, in get_digest_from_pull
  File "compose/service.py", line 1187, in _do_pull
  File "site-packages/docker/api/image.py", line 381, in pull
  File "site-packages/docker/auth.py", line 48, in get_config_header
  File "site-packages/docker/auth.py", line 322, in resolve_authconfig
  File "site-packages/docker/auth.py", line 235, in resolve_authconfig
  File "site-packages/docker/auth.py", line 262, in _resolve_authconfig_credstore
  File "site-packages/docker/auth.py", line 287, in _get_store_instance
  File "site-packages/dockerpycreds/store.py", line 25, in __init__
dockerpycreds.errors.InitializationError: docker-credential-desktop not installed or not available in PATH
[7968] Failed to execute script docker-compose

To fix this issue, first need to check what the config is in ~/.docker. Sometimes the configuration contains below:

cat config.json 
{
  "stackOrchestrator" : "swarm",
  "credsStore" : "desktop",
  "experimental" : "disabled",
  "auths" : {

  }
}

You will find the credsStore config is desktop. That's why it tries to run docker-credential-desktop. Just update this config file and change the credsStore to osxkeychain from desktop should resolve the issue.

sed -i~ 's/"desktop"/"osxkeychain"/g' ~/.docker/config.json

New config.json.

{
  "stackOrchestrator" : "swarm",
  "credsStore" : "osxkeychain",
  "experimental" : "disabled",
  "auths" : {

  }
}

And now if you run the command again, you should not see this issue anymore. 

Other solution would be you try to install docker-credential-helper. But to be honest, it doesn't work for me.

DOCKER  MACOS  DOCKER-COMPOSE 

       

  RELATED


  0 COMMENT


No comment for this article.



  RANDOM FUN

DO NOT DISTURB