docker容器内使用curl命令,拒绝连接

root@268e5b5bc658:/# curl -v -X POST "http://127.0.0.1:8090/actuator/bus-refresh"
*   Trying 127.0.0.1...
* connect to 127.0.0.1 port 8090 failed: Connection refused
* Failed to connect to 127.0.0.1 port 8090: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 127.0.0.1 port 8090: Connection refused

原来在docker容器内,localhost和127.0.0.1都是引用容器本身,必须通过其公共主机名/ IP引用主机,就好像它是网络上的另一台机器一样。

参考链接:https://bbs.csdn.net/topics/394364394

你可能感兴趣的:(java,docker,容器,运维,后端,tomcat)