2024년 5월 3일 금요일

docker-credential-helper 설치

 rocky linux

gpt에게 문의 했을때 

1. docker-credential-helpers 패키지 설치

Docker의 credential helper를 설치하려면 패키지를 추가로 설치해야 합니다. Rocky Linux에서는 다음과 같이 설치할 수 있습니다.

bash
sudo dnf install docker-credential-helpers

이 패키지에는 다양한 Docker credential helpers가 포함되어 있습니다. 설치 후 다시 확인하세요.

>>실행 후

sudo dnf install docker-credential-helpers

Last metadata expiration check: 0:00:31 ago on Fri 03 May 2024 02:32:46 PM KST. No match for argument: docker-credential-helpers Error: Unable to find a match: docker-credential-helpers

다시 문의

Rocky Linux에서 "docker-credential-helpers" 패키지를 찾을 수 없는 경우, 해당 패키지가 공식 리포지토리에서 제공되지 않을 수 있습니다. 이 경우 docker-credential-pass를 직접 설치해야 합니다. 다음은 이 문제를 해결하기 위한 몇 가지 방법입니다.

1. docker-credential-pass 직접 설치

docker-credential-pass를 직접 설치하려면 GitHub에서 소스 코드를 가져와서 컴파일하는 방법을 사용할 수 있습니다. 이를 위해서는 Golang이 필요합니다. 이 과정은 몇 가지 단계를 포함합니다.

  1. Golang 설치 Rocky Linux에서 Golang을 설치합니다.

    bash
    sudo dnf install golang
  2. Git 설치 Git를 사용하여 소스 코드를 클론하기 위해 Git가 필요합니다.

    bash
    sudo dnf install git
  3. Docker Credential Helper 저장소 클론 GitHub에서 Docker Credential Helper 소스 코드를 클론합니다.

    bash
    git clone https://github.com/docker/docker-credential-helpers.git
  4. 컴파일 및 설치 docker-credential-helpers 디렉토리로 이동하여 pass를 컴파일하고 설치합니다.

    bash
    cd docker-credential-helpers/pass go build

    이제 docker-credential-pass 실행 파일이 생성됩니다. 이 파일을 시스템 경로에 배치해야 합니다.

  5. 실행 파일 시스템 경로에 복사 docker-credential-pass/usr/local/bin 또는 시스템의 다른 PATH에 복사합니다.

    bash
    sudo cp docker-credential-pass /usr/local/bin/

2. Docker 재시작

docker-credential-pass 설치 후, Docker를 재시작합니다.

bash
sudo systemctl restart docker

3. PATH 변수 확인

설치한 docker-credential-pass가 올바른 경로에 있는지 확인합니다.

bash
which docker-credential-pass

이 명령어가 /usr/local/bin/docker-credential-pass 또는 유사한 경로를 반환해야 합니다. 이제 Docker의 config.json에서 설정한 credsStore 값에 따라 pass를 사용할 수 있습니다.

위의 단계를 따라 docker-credential-pass를 설치하고 오류를 해결할 수 있습니다. 다시 시도하여 문제가 해결되었는지 확인하세요.

>> git에서 clone 후 docker-credential-helpers/pass 경로로 이동후 go build 실행

>> 아무런 메세지 없음 >> https://github.com/docker/docker-credential-helpers 이동 메뉴얼 확인

Use make to build the program you want. That will leave an executable in the bin directory inside the repository.

$ make osxkeychain

3 - Put that binary in your $PATH, so Docker can find it.

$ cp bin/build/docker-credential-osxkeychain /usr/local/bin/

그렇다. make로 빌드 해야 한다.

나는 pass를 사용할 것이기 때문에 make pass 명령어 실행
cd bin/build/



있다!!

이제 다시 하라는 대로 /usr/local/bin 폴더로 복사


bash
cp cp bin/build/docker-credential-pass /usr/local/bin/

도커로 로그인 시도 했으나

WARNING! Using --password via the CLI is insecure. Use --password-stdin. Error saving credentials: error storing credentials - err: exec: "docker-credential-pass": executable file not found in $PATH, out: ``

경로에 실행가능한 파일이 없단다...뭐지???


복사하면서 권한이 바꼈나 보다.

실행권한 넣어주고

chmod 764 docker-credential-pass

도커로 다시 로그인 시도.
docker login




성공! 이제 이미지 배포하러 가봐야 겠다.