502 Bad Gateway - nginx/1.14.0 (Ubuntu): 로컬에서 이미지를 찾을 수 없음 + 데몬 오류 응답

최근 Dell 서버를 한 위치에서 다른 위치로 이전했습니다. 메인 OS/VM 매니저는 Proxmox VE 5.3입니다. 여러 다른 VM들을 리버스 프록시하는 Nginx VM이 있으며, 그중 하나가 Discourse VM입니다.

새 라우터를 설정한 후, 일부 VM이 인터넷에 연결되도록 했습니다(SSL 인증서를 갱신할 필요조차 없었죠). 하지만 Discourse의 경우, 브라우저에서 Discourse에 접근하려고 할 때 502 Bad Gateway - nginx/1.14.0 (Ubuntu) 오류를 받고 있습니다.

이전에 이 오류를 받은 적이 있지만, 보통 아래 방법 중 하나로 해결되었습니다:

Discourse VM 재시작

여전히 브라우저에서 502 Bad Gateway - nginx/1.14.0 (Ubuntu) 오류가 발생합니다.

브라우저 쿠키 삭제 및 다른 브라우저 사용

혹시 제 쪽에 문제가 있는 건 아닌지 확인해 보았습니다 … 아닙니다. 여러 브라우저에서 동일한 502 Bad Gateway - nginx/1.14.0 (Ubuntu) 오류가 발생합니다.

Discourse 정리 및 디스크 공간 확인

처음 정리할 때 약 4GB의 데이터가 삭제되었습니다. 매우 놀랐습니다. 어쩌면 이것이 처음부터 문제를 일으킨 원인일까요? 어쨌든, 이제 Discourse를 정리하려고 하면:

> root@forum:/var/discourse# ./launcher cleanup
> WARNING! This will remove all stopped containers.
> Are you sure you want to continue? [y/N] y
> Total reclaimed space: 0B
> WARNING! This will remove all images without at least one container associated to them.
> Are you sure you want to continue? [y/N] y
> Total reclaimed space: 0B

또한 디스크 공간이 부족하지 않다는 점을 다시 강조합니다:

Git Pull

최신 상태입니다.

> root@forum:/var/discourse# git pull
> Already up to date.

Discourse 재시작

여기서 두 가지 오류를 발견했습니다:

> root@forum:/var/discourse# ./launcher restart 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
> 
> Unable to find image 'discourse/base:2.0.20191013-2320' locally
> /usr/bin/docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
> 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`

제시된 링크를 확인했습니다. Git Pull 실행과 Discourse 재빌드(아래에서 제가 겪는 내용을 확인하실 수 있습니다)를 권장합니다. 또한 Docker “Hello World” 명령 실행을 제안합니다. 작동합니다(다만 일부 문제가 있는 것 같습니다?):

> root@forum:/var/discourse# docker run -it --rm hello-world
> Unable to find image 'hello-world:latest' locally
> latest: Pulling from library/hello-world
> 1b930d010525: Pull complete
> Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f
> Status: Downloaded newer image for hello-world:latest
> 
> Hello from Docker!
> This message shows that your installation appears to be working correctly.
> 
> To generate this message, Docker took the following steps:
>  1. The Docker client contacted the Docker daemon.
>  2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
>     (amd64)
>  3. The Docker daemon created a new container from that image which runs the
>     executable that produces the output you are currently reading.
>  4. The Docker daemon streamed that output to the Docker client, which sent it
>     to your terminal.
> 
> To try something more ambitious, you can run an Ubuntu container with:
>  $ docker run -it ubuntu bash
> 
> Share images, automate workflows, and more with a free Docker ID:
>  https://hub.docker.com/
> 
> For more examples and ideas, visit:
>  https://docs.docker.com/get-started/
> 
> failed to resize tty, using default size

그럼, 다음으로 Ubuntu Bash를 시도해 보았습니다 … 오류 발생:

> root@forum:/var/discourse# docker run -it ubuntu bash
> Unable to find image 'ubuntu:latest' locally
> docker: Error response from daemon: Get https://registry-1.docker.io/v2/library/ubuntu/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fubuntu%3Apull&service=registry.docker.io: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
> See 'docker run --help'.

알고 있는 다른 방법들을 시도해 볼 시간입니다:

Discourse 중지 및 시작

재시작 시와 동일한 오류가 발생합니다:

> root@forum:/var/discourse# ./launcher stop 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
> 
> Unable to find image 'discourse/base:2.0.20191013-2320' locally
> /usr/bin/docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
> 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`
> 
> root@forum:/var/discourse# ./launcher start 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
> 
> Unable to find image 'discourse/base:2.0.20191013-2320' locally
> /usr/bin/docker: Error response from daemon: Get https://registry-1.docker.io/v2/discourse/base/manifests/2.0.20191013-2320: Get https://auth.docker.io/token?scope=repository%3Adiscourse%2Fbase%3Apull&service=registry.docker.io: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
> 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`

Discourse 재빌드

그리고 다시 동일한 두 가지 오류가 발생합니다.

> root@forum:/var/discourse# ./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
> 
> Unable to find image 'discourse/base:2.0.20191013-2320' locally
> /usr/bin/docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
> 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

이전 백업에서 복원

서버를 이전하고 정리(약 4GB의 파일이 정리됨)를 하기 전 시점의 스냅샷이 있습니다. 위에서 언급한 정리를 제외하고, 위의 모든 것을 다시 시도해 보았지만 … 결과는 동일했으며, 브라우저에서는 여전히 502 Bad Gateway - nginx/1.14.0 (Ubuntu) 오류가 발생합니다. 그렇다면 이것은 정리와 아무 관련이 없는 것일까요?

Discourse를 사용하면서 이 두 가지 오류 중 하나도 경험해 본 적이 없습니다. 이러한 오류를 해결하고 브라우저에서 Discourse를 실행할 수 있도록 해 줄 수 있는 제안이 있을까요?