前些天發現了一個巨牛的人工智能學習網站,通俗易懂,風趣幽默,忍不住分享一下給大家。點擊跳轉到教程。
1. Docker 中安裝并啟動好網關 kong 后,想要安裝 kong 的圖形化界面 kong-dashboard ,運行命令:
docker run --rm -p 8080:8080 --name kong-dashboard pgbi/kong-dashboard start --kong-url http://xxx.xxx.xxx.xxx:8001
報錯如下:
Connecting to Kong on http://xxx.xxx.xxx.xxx:8001 ...Could not reach Kong on http://xxx.xxx.xxx.xxx:8001
Error details:
{ Error: connect ETIMEDOUT xxx.xxx.xxx.xxx:8001at Object._errnoException (util.js:1019:11)at _exceptionWithHostPort (util.js:1041:20)at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1175:14)code: 'ETIMEDOUT',errno: 'ETIMEDOUT',syscall: 'connect',address: 'xxx.xxx.xxx.xxx',port: 8001 }
2.? 原因:連接拒絕錯誤的是因為2個容器(kong 和 kong-dashboard)在默認橋接網絡上,這不會執行DNS解析。
需要創建一個用戶定義的橋接網絡并將這兩個容器添加到該網絡 。
3.?解決:
創建橋梁網絡
docker network create my-net
將Kong容器添加到它
docker network connect my-net kong
運行kong-dashboard時提供網絡信息
docker run --rm --network my-net -p 8080:8080 pgbi/kong-dashboard start --kong-url http://kong:8001
PS : 最后一行命令運行 kong-dashboard 時,最末我原本是寫的是“http://xxx.xxx.xxx.xxx:8001”,這樣報錯依舊,直到改為如上寫成:“http://kong:8001”才行。
?
參考:https://github.com/PGBI/kong-dashboard/issues/156