Docker를 통해 Ubuntu에 Google Cloud Ops Agent를 설치하려고 하는데 몇 가지 문제가 발생합니다.
첫째, 다음을 실행하면 일부 GPG 서명을 확인할 수 없다는 오류가 반환됩니다.
FROM ubuntu:impish
RUN apt update
RUN apt -y install curl
RUN curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh && bash add-google-cloud-ops-agent-repo.sh --also-install --verbose
CMD ["tail", "/dev/null"]
오류:
#6 20.71 Hit:1 http://ports.ubuntu.com/ubuntu-ports impish InRelease
#6 21.00 Hit:2 http://ports.ubuntu.com/ubuntu-ports impish-updates InRelease
#6 21.00 Get:3 https://packages.cloud.google.com/apt google-cloud-ops-agent-impish-all InRelease [5474 B]
#6 21.09 Err:3 https://packages.cloud.google.com/apt google-cloud-ops-agent-impish-all InRelease
#6 21.09 The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB
#6 21.33 Hit:4 http://ports.ubuntu.com/ubuntu-ports impish-backports InRelease
#6 21.64 Hit:5 http://ports.ubuntu.com/ubuntu-ports impish-security InRelease
#6 21.72 Reading package lists...
#6 22.12 W: GPG error: https://packages.cloud.google.com/apt google-cloud-ops-agent-impish-all InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB
#6 22.12 E: The repository 'https://packages.cloud.google.com/apt google-cloud-ops-agent-impish-all InRelease' is not signed.
이 문제를 해결하기 위해 온라인에서 찾은 몇 가지 조언에 따라 다음을 추가했습니다.
RUN apt -y install software-properties-common
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FEEA9169307EA071 8B57C5C2836F4BEB
다음 Dockerfile을 제공합니다.
FROM ubuntu:impish
RUN apt update
RUN apt -y install software-properties-common curl
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FEEA9169307EA071 8B57C5C2836F4BEB
RUN curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh && bash add-google-cloud-ops-agent-repo.sh --also-install --verbose
CMD ["tail", "/dev/null"]
더 이상 사용되지 않는 경고 apt-key
와 Ops Agent에 대한 "설치 실패" 오류가 발생합니다.
#7 7.659 E: Unable to locate package google-cloud-ops-agent
#7 7.659 + fail 'google-cloud-ops-agent installation failed.'
#7 7.660 ++ date +%Y-%m-%dT%H:%M:%S%z
#7 7.661 + echo '[2022-05-02T20:40:14+0000] google-cloud-ops-agent installation failed.'
#7 7.661 [2022-05-02T20:40:14+0000] google-cloud-ops-agent installation failed.
에 따르면운영 에이전트 Google 문서우분투 Impish가 지원됩니다. Ubuntu를 버전 21.10(impish)에서 20.04(focus)로 변경해도 도움이 되지 않는 것 같습니다.
GPG 문제를 해결하고 Ubuntu에 Google Ops Agent를 설치하는 더 나은 방법에 대한 조언을 주시면 감사하겠습니다.
답변1
gpg 키를 가져오는 데 필요한 패키지가 누락되어 가져오기가 실패하여 초기 오류가 발생합니다.
패키지 설치 줄을 다음으로 바꿉니다.
RUN apt-get -y install curl gnupg
팁:apt-get
대신 스크립트에서 사용하세요 apt
. apt는 최종 사용자가 쉽게 사용할 수 있도록 만들어졌기 때문에 "실제" 작업은 apt-get에 의해 수행됩니다.
또한 apt-key
두 번째 시도에서 추가한 명령이 Ubuntu 서버에서 키를 가져오려고 시도하지만 패키지가 Google 서버에서 다운로드되고 있으므로 키 가져오기는 Google 서버에서 수행되어야 합니다.
ops-agent 설치 스크립트에서 비슷한 apt-key
명령이 실행되지만 대상을 지정하는 것을 볼 수 있습니다.https://packages.cloud.google.com/apt/doc/apt-key.gpg.
따라서 이 경우 필수 패키지가 있는 경우 설치 스크립트가 자동으로 키를 가져오기 때문에 키를 직접 가져올 필요가 없습니다 gnupg
.