😕

「`docker.credentials.errors.InitializationError`」への対処

2021/01/07に公開

事象

"'docker-compose build'"を実行すると、
docker.credentials.errors.InitializationError」が出力される。

masa@DESKTOP-0CNPS43:~/environment/RailsTutorial$ docker-compose build
postgres uses an image, skipping
redis uses an image, skipping
Building web
Traceback (most recent call last):
  File "bin/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 "docker/api/build.py", line 261, in build
  File "docker/api/build.py", line 308, in _set_auth_headers
  File "docker/auth.py", line 301, in get_all_credentials
  File "docker/auth.py", line 287, in _get_store_instance
  File "docker/credentials/store.py", line 25, in __init__
docker.credentials.errors.InitializationError: docker-credential-desktop.exe not installed or not available in PATH
[21871] Failed to execute script docker-compose

対処

"'sudo docker-compose build'"を実行する。

masa@DESKTOP-0CNPS43:~/environment/RailsTutorial$ sudo docker-compose build
[sudo] password for masa: 
postgres uses an image, skipping
redis uses an image, skipping
Building web
Step 1/22 : FROM ruby:2.7.2-alpine AS builder
 ---> f811257adce0
...(省略)
Step 22/22 : CMD ["rails", "server", "-b", "0.0.0.0", "-p", "3000"]
 ---> Using cache
 ---> 95c351e8be42

Successfully built 95c351e8be42
Successfully tagged rails-app:0.3.0

Discussion