Discourse Docker 이미지 서명이 되어 있지 않습니다

새로운 머신에 Discourse를 설정하는 중입니다. discourse_docker 저장소를 체크아웃하고 ./launcher rebuild app를 실행했습니다. (이전에 설정 파일이 있었기 때문에 부트스트래핑은 건너뛰었습니다.)

리빌드 결과 다음과 같은 출력이 나타났습니다:

WARNING: We are about to start downloading the Discourse base image
This process may take anywhere between a few minutes to an hour, depending on your network speed

Please be patient

ERRO[0001] Metadata for targets expired
ERRO[0002] Metadata for targets expired
/usr/bin/docker: Error: remote repository docker.io/discourse/base out-of-date: targets expired at Mon Nov 18 12:52:09 -0500 2019.
See '/usr/bin/docker run --help'.
Your Docker installation is not working correctly

See: https://meta.discourse.org/t/docker-error-on-bootstrap/13657/18?u=sam

문제의 근본 원인을 파악하기 위해 실행되는 명령어를 확인하고 디버그 모드로 실행해 보았습니다:

/usr/bin/docker --debug run -i --rm -a stdout -a stderr discourse/base:2.0.20191219-2109 echo working

참고: discourse_docker/launcher at 1b3dd3a41b544592be46b39db563bb757f88bbad · discourse/discourse_docker · GitHub

명령어 출력 내용:
DEBU[0000] reading certificate directory: /root/.docker/tls/notary.docker.io
DEBU[0000] No yubikey found, using alternative key storage: no library found
DEBU[0000] Making dir path: /root/.docker/trust/tuf/docker.io/discourse/base/changelist
DEBU[0000] entered ValidateRoot with dns: docker.io/discourse/base
DEBU[0000] found the following root keys: [5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8]
DEBU[0000] found 1 valid leaf certificates for docker.io/discourse/base: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0000] found 1 leaf certs, of which 1 are valid leaf certs for docker.io/discourse/base
DEBU[0000] checking root against trust_pinning config for docker.io/discourse/base
DEBU[0000] checking trust-pinning for cert: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0000]  role has key IDs: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0000] verifying signature for key ID: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0000] root validation succeeded for docker.io/discourse/base
DEBU[0000] entered ValidateRoot with dns: docker.io/discourse/base
DEBU[0000] found the following root keys: [5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8]
DEBU[0000] found 1 valid leaf certificates for docker.io/discourse/base: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0000] found 1 leaf certs, of which 1 are valid leaf certs for docker.io/discourse/base
DEBU[0000] checking root against trust_pinning config for docker.io/discourse/base
DEBU[0000] checking trust-pinning for cert: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0000]  role has key IDs: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0000] verifying signature for key ID: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0000] root validation succeeded for docker.io/discourse/base
DEBU[0000] updating TUF client
DEBU[0000] Loading timestamp...
DEBU[0001] 200 when retrieving metadata for timestamp
DEBU[0001] timestamp role has key IDs: db679e1f17a2a2bdd9952b6f37c9048635611f162bc6a0957ec30fbb1412d366
DEBU[0001] verifying signature for key ID: db679e1f17a2a2bdd9952b6f37c9048635611f162bc6a0957ec30fbb1412d366
DEBU[0001] timestamp role has key IDs: db679e1f17a2a2bdd9952b6f37c9048635611f162bc6a0957ec30fbb1412d366
DEBU[0001] verifying signature for key ID: db679e1f17a2a2bdd9952b6f37c9048635611f162bc6a0957ec30fbb1412d366
DEBU[0001] successfully verified downloaded timestamp
DEBU[0001] Loading snapshot...
DEBU[0001] snapshot role has key IDs: e88a99d5b23301178976a4a103df4716f7943301d9972db0541bfa17c94cb75b
DEBU[0001] verifying signature for key ID: e88a99d5b23301178976a4a103df4716f7943301d9972db0541bfa17c94cb75b
DEBU[0001] successfully verified cached snapshot
DEBU[0001] Loading targets...
DEBU[0001] no targets in cache, must download
DEBU[0001] 200 when retrieving metadata for targets.09b50021560effa664eb8271cd16e2212ed55b7b63b2127cf9a0e69cfe2b47b7
DEBU[0001] targets role has key IDs: c016860a9293a48bc98f27b9c36d81515f4bcc3dd2ec93bb2d6d8af8f37a39d2
DEBU[0001] verifying signature for key ID: c016860a9293a48bc98f27b9c36d81515f4bcc3dd2ec93bb2d6d8af8f37a39d2
ERRO[0001] Metadata for targets expired
DEBU[0001] downloaded targets.09b50021560effa664eb8271cd16e2212ed55b7b63b2127cf9a0e69cfe2b47b7 is invalid: targets expired at Mon Nov 18 12:52:09 -0500 2019
DEBU[0001] Client Update (Targets): targets expired at Mon Nov 18 12:52:09 -0500 2019
DEBU[0001] Error occurred. Root will be downloaded and another update attempted
DEBU[0001] Resetting the TUF builder...
DEBU[0001] entered ValidateRoot with dns: docker.io/discourse/base
DEBU[0001] found the following root keys: [5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8]
DEBU[0001] found 1 valid leaf certificates for docker.io/discourse/base: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0001] found 1 leaf certs, of which 1 are valid leaf certs for docker.io/discourse/base
DEBU[0001] found the following root keys: [5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8]
DEBU[0001] found 1 valid leaf certificates for docker.io/discourse/base: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0001] found 1 valid root leaf certificates for docker.io/discourse/base: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0001]  role has key IDs: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0001] verifying signature for key ID: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0001] checking root against trust_pinning config for docker.io/discourse/base
DEBU[0001] checking trust-pinning for cert: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0001]  role has key IDs: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0001] verifying signature for key ID: 5f5ba22b20768b8f2d49e9035400a1922ae761aa70b5bb0d930fe91dd06bd5d8
DEBU[0001] root validation succeeded for docker.io/discourse/base
DEBU[0001] successfully verified cached root
DEBU[0001] retrying TUF client update
DEBU[0001] Loading timestamp...
DEBU[0002] 200 when retrieving metadata for timestamp
DEBU[0002] timestamp role has key IDs: db679e1f17a2a2bdd9952b6f37c9048635611f162bc6a0957ec30fbb1412d366
DEBU[0002] verifying signature for key ID: db679e1f17a2a2bdd9952b6f37c9048635611f162bc6a0957ec30fbb1412d366
DEBU[0002] successfully verified downloaded timestamp
DEBU[0002] Loading snapshot...
DEBU[0002] snapshot role has key IDs: e88a99d5b23301178976a4a103df4716f7943301d9972db0541bfa17c94cb75b
DEBU[0002] verifying signature for key ID: e88a99d5b23301178976a4a103df4716f7943301d9972db0541bfa17c94cb75b
DEBU[0002] successfully verified cached snapshot
DEBU[0002] Loading targets...
DEBU[0002] no targets in cache, must download
DEBU[0002] 200 when retrieving metadata for targets.09b50021560effa664eb8271cd16e2212ed55b7b63b2127cf9a0e69cfe2b47b7
DEBU[0002] targets role has key IDs: c016860a9293a48bc98f27b9c36d81515f4bcc3dd2ec93bb2d6d8af8f37a39d2
DEBU[0002] verifying signature for key ID: c016860a9293a48bc98f27b9c36d81515f4bcc3dd2ec93bb2d6d8af8f37a39d2
ERRO[0002] Metadata for targets expired
DEBU[0002] downloaded targets.09b50021560effa664eb8271cd16e2212ed55b7b63b2127cf9a0e69cfe2b47b7 is invalid: targets expired at Mon Nov 18 12:52:09 -0500 2019
DEBU[0002] Client Update (Targets): targets expired at Mon Nov 18 12:52:09 -0500 2019
/usr/bin/docker: Error: remote repository docker.io/discourse/base out-of-date: targets expired at Mon Nov 18 12:52:09 -0500 2019.
See '/usr/bin/docker run --help'.

이런 일이 왜 발생하는지 전혀 모르겠습니다. git 히스토리를 확인하고 이전에 사용했던 베이스 이미지로 되돌려 보았지만 결과는 동일했습니다.

참고: Bump base image · discourse/discourse_docker@1b3dd3a · GitHub

도움 주시면 감사하겠습니다 :slight_smile:

업데이트 #1

@Falco 님의 제안에 따라 Docker 포럼에 이 문제를 논의하기 위한 게시물을 작성했습니다.

운영 체제에 사용할 수 있는 최신 버전으로 Docker를 업데이트한 후 다시 시도해 주시겠습니까?

@Falco님, 답변해 주셔서 감사합니다.

저는 최신 버전의 Docker를 사용하고 있습니다:

Docker version 19.03.5, build 633a0ea838

참고: Docker Engine version 29 release notes | Docker Docs

이전에 언급하지 못한 점 죄송합니다 :roll_eyes:

그럼 단순한

docker pull discourse/base:2.0.20191219-2109

명령이 실패하는 건가요?

네. 이 명령어는 제 첫 번째 게시글에서 설명한 것과 동일한 방식으로 실패합니다:

ERRO[0001] Metadata for targets expired
ERRO[0002] Metadata for targets expired
Error: remote repository docker.io/discourse/base out-of-date: targets expired at Mon Nov 18 12:52:09 -0500 2019

정말 이상하네요. 서버 시계가 올바르게 설정되어 있나요? 이상한 캐싱이나 방화벽 같은 것이 있나요?

@Falco 내 시계가 동기화된 것 같습니다:

$ timedatectl status

                      Local time: Fr 2019-12-27 19:57:48 CET
                  Universal time: Fr 2019-12-27 18:57:48 UTC
                        RTC time: Fr 2019-12-27 18:57:49
                       Time zone: Europe/Berlin (CET, +0100)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

저는 Ubuntu 18.04 LTS를 사용 중입니다.

다른 컨테이너들은 정상적으로 실행된다는 점도 언급하고 싶습니다. 따라서 이는 Discourse 이미지와 어떻게든 관련이 있는 것으로 보입니다.

음, 저는 docker pull discourse/base:2.0.20191219-2109를 여러 OS에서, 그리고 다른 대륙의 서로 다른 클라우드 프로바이더에서도 정상적으로 실행할 수 있으니, 이는 사용자의 로컬 컴퓨터나 Docker 설치 환경에 특이한 문제일 것이라고 생각합니다.

이 문제가 docker 서비스에서 발생하므로, https://forums.docker.com/에서 도움을 구해 보시기 바랍니다.

알겠습니다 @Falco. 지금까지 도와주셔서 감사합니다 :slight_smile:

@Falco Docker 포럼에 게시글을 작성했고 답변을 받았습니다.

이 문제는 DOCKER_CONTENT_TRUST=1과 관련이 있습니다.

이 문제를 재현하려면 다음 명령을 실행할 수 있습니다:

$ export DOCKER_CONTENT_TRUST=1
$ docker pull discourse/base:2.0.20191219-2109

아, 그렇군요. 로컬 머신에서 이 플래그를 왜 설정하셨나요? Ubuntu에서는 기본적으로 활성화되지 않습니다.

인터넷에 서버를 설정하고 있습니다. 이는 제 로컬 머신이 아닙니다. 이 서버는 "하드닝"되어 있어야 하므로 이 옵션이 활성화되어 있습니다.

Ubuntu Server에서도 기본적으로 활성화되어 있지 않습니다.

맞습니다 @Falco . 활성화했습니다. 제가 파악한 바로는 Discourse 이미지가 제대로 서명되지 않았거나 아예 서명이 없는 것 같습니다 (현재 조사 중입니다).

어쨌든, 서명된 이미지/태그를 갖출 수 있으면 좋겠습니다. DCT를 사용하는 사람이 저뿐만이 아닐 것 같거든요.

Docker Bench Security와 같은 감사 도구의 일부입니다 (아래 참조):

4.5  - Docker에 대한 콘텐츠 신뢰 활성화 확인

지금은 비활성화할 수 있지만, Discourse 이미지도 서명된 이미지/태그를 제공받을 수 있다면 정말 좋겠습니다 :slight_smile:

이 이슈를 닫을 수 있도록 기능 요청을 생성해야 할까요?

현재 권장 설치 지침을 벗어나고 있으므로, 다른 사람들이 같은 실수를 하지 않도록 이 문제는 지원되지 않는 항목으로 표시됩니다.