macOSでdocker-composeしたら、エラーが表示されましたが、無事、解決できました。
エラー状況
macOS: 10.15.5
docker desktop: 2.4.0.0 (アップデート後)
python: pyenvのpython 3.8.2
久しぶりにmacOSでdocker-composeしたら、次のエラーが表示されてしまいました。
$ docker-compose build
Building xxxxxx
Traceback (most recent call last):
File "site-packages/docker/credentials/store.py", line 80, in _execute
File "subprocess.py", line 411, in check_output
File "subprocess.py", line 512, in run
subprocess.CalledProcessError: Command '['/usr/local/bin/docker-credential-desktop', 'get']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "site-packages/docker/auth.py", line 264, in _resolve_authconfig_credstore
File "site-packages/docker/credentials/store.py", line 35, in get
File "site-packages/docker/credentials/store.py", line 93, in _execute
docker.credentials.errors.StoreError: Credentials store docker-credential-desktop exited with "error getting credentials - err: exit status 1, out: `User interaction is not allowed.`".
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 72, in main
File "compose/cli/main.py", line 128, in perform_command
File "compose/cli/main.py", line 1077, in up
File "compose/cli/main.py", line 1073, in up
File "compose/project.py", line 548, in up
File "compose/service.py", line 367, in ensure_image_exists
File "compose/service.py", line 1106, in build
File "site-packages/docker/api/build.py", line 261, in build
File "site-packages/docker/api/build.py", line 308, in _set_auth_headers
File "site-packages/docker/auth.py", line 304, in get_all_credentials
File "site-packages/docker/auth.py", line 281, in _resolve_authconfig_credstore
docker.errors.DockerException: Credentials store error: StoreError('Credentials store docker-credential-desktop exited with "error getting credentials - err: exit status 1, out: `User interaction is not allowed.`".')
[8959] Failed to execute script docker-compose
Code language: plaintext (plaintext)
最初「docker.credentials.errors.StoreError」だけで検索したら「gcloud関連のエラーが」という記事が見つかりました。
何か違うと思って、よく読むと、記事のエラーはdocker-credential-gcloud
。ぼくのエラーをよく見ると、docker-credential-desktop
と、微妙に違うエラーでした。
Docker Desktopのアップデートダイアログが表示されていたので、アップデートしました。450MBのダウンロード。Docker Desktopを再起動しました。
すると、もう一度アップデートダイアログが表示されました。今度は480MBのダウンロード。Docker Desktopを再起動しました。
ターミナルでdocker-composeを実行しました。残念ながら、同じエラーでした。
$ docker-compose build
Building xxxxxx
Traceback (most recent call last):
File "site-packages/docker/credentials/store.py", line 80, in _execute
File "subprocess.py", line 411, in check_output
File "subprocess.py", line 512, in run
subprocess.CalledProcessError: Command '['/usr/local/bin/docker-credential-desktop', 'get']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "site-packages/docker/auth.py", line 264, in _resolve_authconfig_credstore
File "site-packages/docker/credentials/store.py", line 35, in get
File "site-packages/docker/credentials/store.py", line 93, in _execute
docker.credentials.errors.StoreError: Credentials store docker-credential-desktop exited with "error getting credentials - err: exit status 1, out: `User interaction is not allowed.`".
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose/cli/main.py", line 67, in main
File "compose/cli/main.py", line 126, in perform_command
File "compose/cli/main.py", line 302, in build
File "compose/project.py", line 468, in build
File "compose/project.py", line 450, in build_service
File "compose/service.py", line 1125, in build
File "site-packages/docker/api/build.py", line 261, in build
File "site-packages/docker/api/build.py", line 308, in _set_auth_headers
File "site-packages/docker/auth.py", line 304, in get_all_credentials
File "site-packages/docker/auth.py", line 281, in _resolve_authconfig_credstore
docker.errors.DockerException: Credentials store error: StoreError('Credentials store docker-credential-desktop exited with "error getting credentials - err: exit status 1, out: `User interaction is not allowed.`".')
[9309] Failed to execute script docker-compose
Code language: plaintext (plaintext)
pyenvのpythonがよくないのかもと思い、macOS標準のpythonにしてみましたが、やはり同じエラーでした。
対応方法
「docker.credentials.errors.StoreError docker-credential-desktop」で検索してみました。「security unlock-keychain」を実行するといいようです。
パスワードを聞かれました。ぼくの場合は、macOSログイン時のパスワードを入力しました。
$ security unlock-keychain
password to unlock default:
Code language: Bash (bash)
ぼくの環境では、これで解決しました。
参考記事
qiitaのお世話になってるわね