Bitbucket 無法存取 Postgres

Bitbucket 無法存取 Postgres

我已經在 VirtualBox 中的 Ubuntu 18.04 上安裝了 Docker 和 Bitbucket,規格如下:

docker run \
-e JDBC_DRIVER=org.postgresql.Driver \
-e JDBC_USER=bitbucket \
-e JDBC_PASSWORD=bitbucket \
-e JDBC_URL=jdbc:postgresql://192.168.56.139:5432/bitbucket \
-v /data/bitbucket-shared:/var/atlassian/application-data/bitbucket \
--name="bitbucket" \
-d -p 7990:7990 -p 7999:7999 \
atlassian/bitbucket-server

目前,我已經安裝了 Postgresql,為 bitbucket 建立了資料庫和使用者名稱。我在 pg_hba.conf 中添加了以下幾行:

host    all             all             127.0.0.1/32            md5
host    all             all             192.168.56.139/32       md5
host    all             all             172.17.0.2/32           md5

我不確定是否應該在那裡添加容器 IP 位址,但我還是添加了。在 postgresql.conf 中,我編輯了以下行:

listen_address = '*'

容器啟動後,我在瀏覽器中收到以下錯誤訊息:

The database, as currently configured, is not accessible.
Connection to 192.168.56.139:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

我沒有在此虛擬機器上設定任何 iptables 規則。儘管如此,我發現資料庫無法存取。

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy DROP)
target     prot opt source               destination
DOCKER-USER  all  --  anywhere             anywhere
DOCKER-ISOLATION-STAGE-1  all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
DOCKER     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
DOCKER     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain DOCKER (2 references)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             172.17.0.2           tcp dpt:7999
ACCEPT     tcp  --  anywhere             172.17.0.2           tcp dpt:7990

Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target     prot opt source               destination
DOCKER-ISOLATION-STAGE-2  all  --  anywhere             anywhere
DOCKER-ISOLATION-STAGE-2  all  --  anywhere             anywhere
RETURN     all  --  anywhere             anywhere

Chain DOCKER-ISOLATION-STAGE-2 (2 references)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere
DROP       all  --  anywhere             anywhere
RETURN     all  --  anywhere             anywhere

Chain DOCKER-USER (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

telnet 192.168.56.139 5432
Trying 192.168.56.139...
telnet: Unable to connect to remote host: Connection refused

知道會是什麼嗎?

謝謝,喬治

相關內容