[英]Error running Tomcat trying to connect to a Docker container
Previously I kept getting the access denied error but at least it was trying to set a connection. 以前,我一直收到拒绝访问错误,但至少它试图建立连接。 Now this is all I get: Caused by: java.sql.SQLException: Could not connect to address=(host=localhost)(port=3306)(type=master).
现在这就是我得到的全部:原因:java.sql.SQLException:无法连接到address =(host = localhost)(port = 3306)(type = master)。 I would appreciate your help.
多谢您的协助。
By default, Docker containers run on a bridge network. 默认情况下,Docker容器在网桥网络上运行。 Thus the Docker container's
localhost
does not point to the localhost of the Docker host inside which the container runs. 因此,多克尔容器的
localhost
不指向其内部的容器中运行的泊坞窗主机的本地主机。
Find out the IP address of your Docker host: 找出您的Docker主机的IP地址:
ifconfig \
| grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" \
| grep -v 127.0.0.1 \
| awk '{ print $2 }' \
| cut -f2 -d: \
| head -n1
Or if you're on macOS, you can use docker.for.mac.localhost
(or docker.for.win.localhost
on Windows). 或者,如果您使用的是macOS,则可以使用
docker.for.mac.localhost
(或Windows上的docker.for.win.localhost
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.