문제상황
jib으로 프로젝트 이미지 빌드도중 발생한 에러입니다.
에러의 내용은 다음과 같습니다.
> Task :jib
Containerizing application to seunggison/msa-currency-exchange-app:0.0.1-SNAPSHOT...
Base image 'openjdk:21' does not use a specific image digest - build may not be reproducible
The system does not have docker-credential-desktop CLI
Caused by: Cannot run program "docker-credential-desktop": error=2, No such file or directory
The system does not have docker-credential-desktop CLI
Caused by: Cannot run program "docker-credential-desktop": error=2, No such file or directory
The system does not have docker-credential-desktop CLI
Caused by: Cannot run program "docker-credential-desktop": error=2, No such file or directory
The system does not have docker-credential-desktop CLI
Caused by: Cannot run program "docker-credential-desktop": error=2, No such file or directory
The base image requires auth. Trying again for openjdk:21...
The system does not have docker-credential-desktop CLI
Caused by: Cannot run program "docker-credential-desktop": error=2, No such file or directory
The system does not have docker-credential-desktop CLI
Caused by: Cannot run program "docker-credential-desktop": error=2, No such file or directory
The system does not have docker-credential-desktop CLI
Caused by: Cannot run program "docker-credential-desktop": error=2, No such file or directory
The system does not have docker-credential-desktop CLI
Caused by: Cannot run program "docker-credential-desktop": error=2, No such file or directory
Using base image with digest: sha256:af9de795d1f8d3b6172f6c55ca9ba1c5768baa11bb2dc8af7045c7db9d4c33ac
Executing tasks:
Executing tasks:
[=========== ] 35.4% complete
> pushing blob sha256:96791907cbb3a871c6611df3b...
> pushing blob sha256:f8a02f907a1ab530de20915a2...
> pushing blob sha256:fd4dae8efc3d04714f85e9343...
> checking base image layer sha256:5262579e8e45...
> checking base image layer sha256:0eab4e2287a5...
> checking base image layer sha256:7c002e8f6062...
> launching layer pushers
> scheduling building manifests
> scheduling pushing container configurations
> Task :jib FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':jib'.
> com.google.cloud.tools.jib.plugins.common.BuildStepsExecutionException: Build image failed, perhaps you should make sure your credentials for 'registry-1.docker.io/seunggison/msa-currency-exchange-app' are set up correctly. See https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#what-should-i-do-when-the-registry-responds-with-unauthorized for help
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 7s
3 actionable tasks: 1 executed, 2 up-to-date
Caused by: Cannot run program "docker-credential-desktop": error=2, No such file or directory The system does not have docker-credential-desktop CLI <- 해당 오류는 도커허브 자격증명 문제때문에 발생하는 오류입니다.
해결방안
터미널을 열고, docker login을 입력후 도커허브 사용자명과 비밀번호를 입력한 뒤 재시도를 해보았지만 똑같은 오류가 다시 발생했었습니다.
구글에서 서칭을 해본 결과, 해결방안을 찾긴 찾았지만 어떻게 해결이 되는건지 이해가 안되는 해결방안이었습니다..
- 파인더를 열고 command + option + g 를 입력하여
~/.docker/config.json경로를 탐색하여 들어갑니다. - config.json 파일을 수정 가능한 프로그램으로 열어줍니다.
- credsStore 라고 되어있는 것을 credStore라고 수정을 하고 저장합니다.
- 다시 터미널로 가서 docker login 입력 후 자격증명을 입력합니다.
위와 같은 과정을 거쳐 오류가 해결이 되었습니다.
해당 해결방안을 이 글에서 제공받았는데, credsStore에서 중간에 s만 제거했더니 오류가 해결되는 방식이 이해가 가질않았습니다. 해당 오류의 정확한 해결과정은 서칭을 해도 자세히 나오질않아 GPT에게 물어보았습니다.
자격 증명을 관리하기 위해 Docker Desktop의 자격 증명 도구인 docker-credential-desktop을 사용하려고 했으나, 이 도구가 없거나 제대로 작동하지 않아서 발생한 문제입니다.
credsStore는 Docker Desktop에서 모든 레지스트리 자격 증명을 하나의 외부 도구(이 경우 docker-credential-desktop)에 위임하여 관리하는 역할을 합니다. 하지만 이 도구가 제대로 작동하지 않으면 Docker가 자격 증명을 처리하지 못해 푸시 실패가 발생하게 됩니다.
- credsStore: Docker Desktop에서 사용되는 자격 증명 관리 도구로 설정되어 있었지만, 제대로 동작하지 않음.
- credStore: Docker가 자격 증명을 관리하는 방식 중 하나로, 레지스트리별 자격 증명 관리 도구를 지정할 수 있습니다. credsStore와 달리 구체적인 도구(예: docker-credential-osxkeychain)를 사용할 수 있습니다.
해석해보면.. 자격 증명을 관리하는 credsStore 설정이 docker-credential-desktop을 사용하고 있었으나 이 도구가 제대로 작동하지 않아서 문제가 발생했고, 이를 credStore로 변경함으로써 다른 자격 증명 관리 도구를 사용하게 되어 해결이 되었다고 볼 수 있겠네요.