WSL2上のUbuntu 20.04において
aws ecr get-login-password --region ap-northeast-1 | docker login --username AWS --password-stdin <id>.dkr.ecr.ap-northeast-1.amazonaws.com
を実行した時に、以下のようなエラーが出た。
Error saving credentials: error storing credentials - err: exit status 1, out: `Post "http://ipc/registry/credstore-updated": open \\.\pipe\dockerBackendApiServer: The system cannot find the file specified.`
ググると ~/.docker/config.json
の "credsStore": "desktop.exe"
を削除すればよいという記事がいくつかヒットしたのでやってみると、たしかにログインは通るのだが、以下のような警告が出る。
WARNING! Your password will be stored unencrypted in /home/marukaz/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
実際に config.json
を改めて確認するとcredentialが平文で書き込まれてしまっている。
ここで改めて "credsStore": "desktop.exe"
という文字列を見て気づいたのだが、Docker Desktopが起動していないだけだった…。
Docker Desktopを起動し、~/.docker/config.json
に書き込まれてしまったcredentialを削除してもう一度冒頭のコマンドを実行したところ、無事ログインできた。