标题:“Connecting Django Application in One Docker Library to MySQL in 另一个集装箱”
我有两辆多克集装箱:
mysql-container
: This container runs a MySQL image.my-django-container
: It hosts a functional Django application.
我的目标是在<密码>上运行的Django申请与MySQL服务器在mysql-container
之间建立联系。 然而,Im遇到数据库连接错误:
django.db.utils.OperationalError: (2002, "Can t connect to server on 36.253.8.13 (115)")
这里是我数据库的Django环境:
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": "name",
"USER": "username",
"PASSWORD": "password",
"HOST": "172.18.0.2", # What should I put here? The actual IP of the server `36.253.8.13` or the IP of the SQL container `172.18.0.2`?
"PORT": "3306", # Is this the default port for SQL?
}
我也把这两个集装箱放在同一个多克网络中,我可以确认,当我使用<条码>多克网络检查<>条码”的指挥对网络进行视察时,这两个集装箱都是明显的。
As a Docker novice, I would greatly appreciate any assistance in resolving this issue.