본문 바로가기
MLOps/Docker

[Docker] error getting credentials ~ 오류 해결

by Toritol 2024. 5. 20.
728x90

 

 

이번 글에서는 docker compose시 발생한 error getting credentials 관련 오류 해결 방법에 대해 간단하게 살펴보고자 합니다. https://mlops-for-mle.github.io/tutorial/의 내용 중 Zookeeper와 Kafka 관련 실습 진행 과정에서 발생한 오류에 대해 작성하였습니다. 저의 docker 실습은 Windows의 wsl을 기반으로 진행되었습니다.

 

우선 Zookeeper와 Kafka와 관련된 docker compose의 내용은 다음과 같습니다.

# naive-docker-compose.yaml
version: "3"

services:
  zookeeper:
    image: confluentinc/cp-zookeeper:7.3.0
    container_name: zookeeper
    ports:
      - 2181:2181
    environment:
      ZOOKEEPER_SERVER_ID: 1
      ZOOKEEPER_CLIENT_PORT: 2181
      
  broker:
    image: confluentinc/cp-kafka:7.3.0
    container_name: broker
    depends_on:
      - zookeeper
    ports:
      - 9092:9092
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0

 

실습 과정에서 기존 docker compose 실행은 문제가 없었으나, 위의 파일을 실행할 때 다음과 같은 오류가 발생하였습니다.

$ docker compose -p kafka-naive -f naive-docker-compose.yaml up -d
[+] Running 0/0
 ⠋ broker Pulling                                                                                                                                                                               0.0s 
 ⠋ zookeeper Pulling                                                                                                                                                                            0.0s 
error getting credentials - err: fork/exec /usr/bin/docker-credential-desktop.exe: exec format error, out: ``

 

관련하여 검색해 보니 wsl로 docker를 설치했을 경우 종종 발생하는 오류 같았습니다. 오류 해결 방법은 해당 글(stackoverflow)에서 찾았습니다. 원래 ~/.docker/config.json의 내용은 다음과 같이 작성되어 있습니다.

$ cat ~/.docker/config.json
{
  "credsStore": "desktop.exe"
}

 

vi를 통해 단순히 'credsStore'를 'credStore'로 변경하면 됩니다.

$ vi ~/.docker/config.json
{
  "credStore": "desktop.exe"
}

 

수정한 이후 다시 docker compose를 실행하면 정상적으로 작동하는 것을 확인할 수 있습니다.

$ docker compose -p kafka-naive -f naive-docker-compose.yaml up -d
[+] Running 16/16
 ✔ broker 2 layers [⣿⣿]      0B/0B      Pulled                                                                                                                                                 57.3s 
   ✔ d32323e291f3 Pull complete                                                                                                                                                                53.5s 
   ✔ ee69ff430d89 Pull complete                                                                                                                                                                53.6s 
 ✔ zookeeper 12 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿]      0B/0B      Pulled                                                                                                                                   57.3s 
   ✔ d5d2e87c6892 Pull complete                                                                                                                                                                13.6s 
   ✔ 008dba906bf6 Pull complete                                                                                                                                                                13.7s 
   ✔ bfeaabe01655 Pull complete                                                                                                                                                                50.5s 
   ✔ 2cb7eb0f5666 Pull complete                                                                                                                                                                50.7s 
   ✔ f70f416c6ce7 Pull complete                                                                                                                                                                50.7s 
   ✔ bc67d000e59b Pull complete                                                                                                                                                                51.2s 
   ✔ d6e744651f37 Pull complete                                                                                                                                                                51.2s 
   ✔ 0427d86fae81 Pull complete                                                                                                                                                                51.2s 
   ✔ 4108e73e61e1 Pull complete                                                                                                                                                                51.2s 
   ✔ ac5563423559 Pull complete                                                                                                                                                                51.2s 
   ✔ fa08a06f385f Pull complete                                                                                                                                                                53.5s 
   ✔ bddb49e2fc4d Pull complete                                                                                                                                                                53.6s 
[+] Running 3/3
 ✔ Network kafka-naive_default  Created                                                                                                                                                         0.1s 
 ✔ Container zookeeper          Started                                                                                                                                                       2.3s 
 ✔ Container broker             Started

 

 

<참고>

https://stackoverflow.com/questions/65896681/exec-docker-credential-desktop-exe-executable-file-not-found-in-path

 

exec: "docker-credential-desktop.exe": executable file not found in $PATH

I got this error during docker build: => ERROR [internal] load metadata for docker.io/library/ubuntu:18.04 ...

stackoverflow.com

 

728x90

댓글