Compose: docker-compose can't handle when docker-credential-osxkeychain is gone

Created on 13 Feb 2019  路  25Comments  路  Source: docker/compose

Description of the issue

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.24.0-rc1, build 0f3d4dda
docker-py version: 3.7.0
CPython version: 3.6.6
OpenSSL version: OpenSSL 1.1.0h  27 Mar 2018

Output of docker version

Client: Docker Engine - Community
 Version:           18.09.1
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        4c52b90
 Built:             Wed Jan  9 19:33:12 2019
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.1
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       4c52b90
  Built:            Wed Jan  9 19:41:49 2019
  OS/Arch:          linux/amd64
  Experimental:     true

Output of docker-compose config
(Make sure to add the relevant -f and other flags)

ERROR: 
        Can't find a suitable configuration file in this directory or any
        parent. Are you in the right directory?

        Supported filenames: docker-compose.yml, docker-compose.yaml

Steps to reproduce the issue

  1. Open Docker for Mac preferences
  2. Uncheck "Securely store Docker logins in macOS keychain

  3. docker-compose up

Observed result

traceback

Expected result

containers start running

Stacktrace / full error message

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 344, in ensure_image_exists
  File "compose/service.py", line 1084, in build
  File "site-packages/docker/api/build.py", line 260, in build
  File "site-packages/docker/api/build.py", line 307, in _set_auth_headers
  File "site-packages/docker/auth.py", line 301, in get_all_credentials
  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-osxkeychain not installed or not available in PATH
[63650] Failed to execute script docker-compose

Additional information

OS version / distribution, docker-compose install method, etc.

arecredentials kinbug

Most helpful comment

@ssbarnea You'll need to edit your CLI config file manually.

If you would like to use the macOS keychain then you need to:

  1. Make sure that you have the option checked in the Docker Desktop preferences
  2. Ensure that your ~/.docker/config.json file contains "credsStore" : "osxkeychain"
  3. Login to the registry that you want to use

If you would not like to use the macOS keychain then you need to:

  1. Make sure that the option is unchecked in the Docker Desktop preferences
  2. Ensure that your ~/.docker/config.json does not contain "credsStore": "osxkeychain"
  3. Login to the registry that you want to use

Let me know if you run into any trouble

All 25 comments

I'm getting a similar error with this version on Mac:

Traceback (most recent call last):
  File "site-packages/dockerpycreds/store.py", line 80, in _execute
  File "subprocess.py", line 336, in check_output
  File "subprocess.py", line 418, in run
subprocess.CalledProcessError: Command '['/usr/local/bin/docker-credential-osxkeychain', 'list']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

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 360, in ensure_image_exists
  File "compose/service.py", line 1084, in build
  File "site-packages/docker/api/build.py", line 260, in build
  File "site-packages/docker/api/build.py", line 307, in _set_auth_headers
  File "site-packages/docker/auth.py", line 302, in get_all_credentials
  File "site-packages/dockerpycreds/store.py", line 71, in list
  File "site-packages/dockerpycreds/store.py", line 93, in _execute
dockerpycreds.errors.StoreError: Credentials store docker-credential-osxkeychain exited with "The specified item could not be found in the keychain.".

This started happening to me as well with edge 2.0.2.1 (311274) and presents the same regardless of if "securely store docker logins in macOS keychain" is selected. Note that when it's deselected then I don't get the first error @ineffyble gets.

If I log in with dockerID via the Docker Desktop menu GUI, the errors go away and docker-compose works.

If I log back out, it still works without errors, so there's something happening that is "cleared out" by logging out and back in.

ping @ulyssessouza @chris-crone PTAL

I get both of these errors in different context.

When the option Securely store Docker login in macOS keychain I get the OP error. When I enable it back, I get the same error as @ineffyble. When I do docker login the error goes away. When I do docker logout I am back the with the second error. Seems like two related but distinct bugs to me.

This might be caused by an issue in Docker Desktop which is storing if it is using the keychain in ~/.docker/config.json with the incorrect key: "credSstore" : "osxkeychain" instead of credsStore.

I've raised this with them and will keep this issue updated.

Confirmed that this is the issue. As this is a Desktop issue and not a Compose issue, I will close this. Thank you for reporting it!

EDIT: The Desktop team will fix this for the next release so there's nothing for you to do.

@chris-crone So bug closed without a fix release or workaround? Is anything we can to to bypass this issue?

@ssbarnea You'll need to edit your CLI config file manually.

If you would like to use the macOS keychain then you need to:

  1. Make sure that you have the option checked in the Docker Desktop preferences
  2. Ensure that your ~/.docker/config.json file contains "credsStore" : "osxkeychain"
  3. Login to the registry that you want to use

If you would not like to use the macOS keychain then you need to:

  1. Make sure that the option is unchecked in the Docker Desktop preferences
  2. Ensure that your ~/.docker/config.json does not contain "credsStore": "osxkeychain"
  3. Login to the registry that you want to use

Let me know if you run into any trouble

From the Docker Desktop icon, I logged in to the Docker (clicking the Sign in / Create Docker ID) and after that I was able to run again the docker commands.

@ssbarnea You'll need to edit your CLI config file manually.

If you would like to use the macOS keychain then you need to:

  1. Make sure that you have the option checked in the Docker Desktop preferences
  2. Ensure that your ~/.docker/config.json file contains "credsStore" : "osxkeychain"
  3. Login to the registry that you want to use

If you would not like to use the macOS keychain then you need to:

  1. Make sure that the option is unchecked in the Docker Desktop preferences
  2. Ensure that your ~/.docker/config.json does not contain "credsStore": "osxkeychain"
  3. Login to the registry that you want to use

Let me know if you run into any trouble

Thank you! Your post helped me a lot. One addition: I didn't have "credsStore": "osxkeychain", I had "credsStore":"desktop". I had to remove this whole entry and then I could build successfully.

I had the "credsStore": "osxkeychain" twice in my config.json, after removing one the issue is gone.

I also removed the second credsStore value and just replaced it with what @Fox32 has in his comment and it was working again

Was the second instance of that configuration added automatically? (e.g. after upgrading docker?)

Yeah and weird thing, although I didn't really think about it at the time was that the key was "credSstore" and not what I expected "credsStore". The wrong S in the key was capitalised

Was the second instance of that configuration added automatically? (e.g. after upgrading docker?)

I can't answer that. Maybe there was a Docker for Mac update. But it could also be caused by the Idea Docker plugin. Not sure if it tries to configure it automatically.
But definitly not manually.

I can confirm that this occurred after an OSX upgrade of Docker to 2.1.0.0 36874. I had 2 credsStore entries and one of them has the capitalized S in the wrong place. After deleting "credsStore":"desktop" and editing so that all I had was "credsStore":"", docker-compose --build worked.

I had this:

_cat ~/.docker/config.json_

{"auths":{},"credsStore":"", "credsStore":"desktop","stackOrchestrator":"swarm"}

I updated to this:

{"auths":{},"credsStore":"","stackOrchestrator":"swarm"}

Now docker-compose build is working again :)

None of the suggestions worked for me. As I pointed out here; the problem occurred to me when upgrading to stable/2.1.0.0.

Please let's find a truly reliable solution for this, instead of patchy workarounds.

Downgrading is how I made it work.

  1. Close any terminal you had opened.
  2. Delete your previous Docker for Desktop from your system (by simply removing it from your Applications).
  3. Download the latest stable release Docker Community Edition 2.0.0.3 2019-02-15: https://download.docker.com/mac/stable/31259/Docker.dmg.
  4. (Be careful not to delete unwanted info from your config) Initialize your credentials configuration by running: docker-credential-gcr configure-docker

First login:
docker login

Then try again:
docker-compose up

and just delete the files in the folder and everything goes back to normal ~/.docker

I just deleted the credStore key in my ~/.docker/config.json and restarted Docker...that fixed it.

Hi @chris-crone I followed the same and 'docker login' is working fine for me! But, while I'm trying to push an image in dockerhub then it's throwing the below error.

docker image push himanshu/web1:latest
The push refers to repository [docker.io/himanshu/web1]
39e785d74fb4: Preparing
9c369364f19c: Waiting
2d47128370af: Waiting
7bebde348a1d: Waiting
cf7c2c56cca4: Waiting
767a7c7a385e: Waiting
8ffe9a6b762e: Waiting
a539b76feca4: Waiting
3e207b409db3: Waiting
denied: requested access to the resource is denied

From the Docker Desktop icon, I logged in to the Docker (clicking the Sign in / Create Docker ID) and after that I was able to run again the docker commands.

Thank you so much Dude!

From the Docker Desktop icon, I logged in to the Docker (clicking the Sign in / Create Docker ID) and after that I was able to run again the docker commands.

I noticed I had this issue inside jetbrains IDE's (shell) when running but not in iterm2 (zsh). After logging out and back in, SH/ZSH inside and outside jetrabrain IDE's now works as well. (In case others come across this)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dazorni picture dazorni  路  3Comments

29e7e280-0d1c-4bba-98fe-f7cd3ca7500a picture 29e7e280-0d1c-4bba-98fe-f7cd3ca7500a  路  3Comments

dimsav picture dimsav  路  3Comments

davidbarratt picture davidbarratt  路  3Comments

HackerWilson picture HackerWilson  路  3Comments