想要透過遠端請求的話,就必須設定監聽的 port
step 1
創建 /etc/systemd/system/docker-tcp.socket 檔案,內容如下:
[Unit]
Description=Docker Socket for the API
[Socket]
ListenStream=8888
Service=docker.service
[Install]
WantedBy=sockets.target
step 2
systemctl stop docker
systemctl enable docker-tcp.socket
systemctl enable docker.socket
systemctl start docker-tcp.socket
systemctl start docker
step 3
測試與驗證:
curl -X GET http://localhost:8888/info
參考資料:
Docker开启Remote API 访问 2375端口
沒有留言:
張貼留言