我正在尝试在Docker上安装Mezzanine来测试Docker
我已将此Container与this postgres db一起使用,并在Mezzanine容器上进行了一些自定义(即注释),并使用start.sh脚本包含数据库信息。
当我运行这两个Docker命令时:
var d2, d3;
try {
var d1 = doSomething1();
d2 = doSomething2(d1);
}
catch(e){
d3 = errorHandler3(e);
}
try {
if (!d3) d3 = doSomething3(d2);
}
catch (e){
d3 = "not set";
}
result = d3;
它抛出此错误: 服务器是否在主机“127.0.0.1”上运行并接受 端口5432上的TCP / IP连接?
为什么呢?只需要一个正确方向的指针。
答案 0 :(得分:1)
I agree with @helmbert because sometimes I encounter weird behavior of docker-compose
. For me it seems like docker-compose
can't guarantee the containers run order. So if mezzanine
starts before the database initialization, it will obviously fail.
But the nature of the error that you describe suggests that your django
-based application is improperly configured. Check the value of DATABASES['default']['HOST']
in settings.py
, it must be equal to db
.