localhost
for a container is the container itself. You need to either create the container in host network mode (docker run --net=host ...
) to be able to connect via localhost
or to provide a local network IP to connect to the database (not a loopback IP like '127.0.0.1').
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…