Closed2

dockerで「curl: (7) Failed to connect to exsample.com port 443: No route to host」

BearBeeBearBee

dockerでwordpress+next.jsの構成を構築中。

実現したいこと

nextjsとwordpress間のやり取りは、httpsで行えないか確認中。

コンテナ間通信をすればよいのでは?
と思ったけど、実際に動かして見ると以下のログが出ていた。

TypeError: fetch failed
    at Object.processResponse (node:internal/deps/undici/undici:5575:34)
    at node:internal/deps/undici/undici:5901:42
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:202:9)
    at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  cause: Error: connect ECONNREFUSED 172.20.0.5:443
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1195:16) {
    errno: -111,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '172.20.0.5',
    port: 443
  }
}

httpsが通信できていない?
ということでping、curl、nslookupを実施

ping:正常

curl

/usr/src/app/cms-wordpress-app# curl https://example.com
curl: (7) Failed to connect to example.com port 443: No route to host

nslookup

/usr/src/app/cms-wordpress-app# nslookup example.com
Server:         127.0.0.11
Address:        127.0.0.11#53

Non-authoritative answer:
Name:   example.com
Address: xxx.xxx.xxx.xxx

とりあえず、curlが正常に動くようにする。

BearBeeBearBee

ブログのカバー画像で500エラー

https://example.com/_next/image?url=https://コンテナ名/image_path/image.png
このスクラップは2025/01/23にクローズされました