简体   繁体   English

Docker Rundeck +本地Postgres

[英]Docker Rundeck + local Postgres

I'm trying to run a docker image of rundeck, using PostGres for the database. 我正在尝试使用PostGres为数据库运行rundeck的docker镜像。

The issue I'm having is mapping my local postgres installation to the docker rundeck image. 我遇到的问题是将我的本地postgres安装映射到docker rundeck映像。 The postgres port runs on 5432, and have confirmed using netstat that the port is open and listening. postgres端口在5432上运行,并已确认使用netstat端口是打开和侦听的。 The port for rundeck needs to run on 4440. rundeck的端口需要在4440上运行。

I have tried the following command: 我尝试了以下命令:

docker run -p 127.0.0.1:4440:4440 -e RUNDECK_DATABASE_URL=jdbc:postgresql://localhost/rundeck -e RUNDECK_DATABASE_DRIVER=org.postgresql.Driver -e RUNDECK_DATABASE_USERNAME=xxx -e RUNDECK_DATABASE_PASSWORD=xxx --name test-rundeck -t rundeck/rundeck:3.0.19 

But it fails with an error: Connection to 127.0.0.1:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP 但它失败并出现错误: Connection to 127.0.0.1:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP Connection to 127.0.0.1:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP

I'm guessing it's because the internal 5432 port isnt mapped to the docker container port 5432? 我猜是因为内部5432端口没有映射到docker容器端口5432?

I tried mapping the ports with -p 127.0.0.1:5432:5432 but that fails with the error: 我尝试使用-p 127.0.0.1:5432:5432映射端口,但失败并显示错误:

Error starting userland proxy: listen tcp 127.0.0.1:5432: bind: address already in use

At this point I might just resort to running both PostGres and Rundeck as docker images, but I would rather like to resolve this problem. 在这一点上,我可能只是将PostGres和Rundeck作为docker图像运行,但我宁愿解决这个问题。

Any ideas on how to map a local PostGres to a docker ran Rundeck? 有关如何将本地PostGres映射到docker的任何想法都运行Rundeck?

Found the answer. 找到了答案。

Had to edit the pg_hba.conf file to allow the docker0 ip address through. 不得不编辑pg_hba.conf文件以允许docker0 ip地址通过。

host    all             all             172.23.0.0/16           md5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM