LoginSignup
0
0

More than 3 years have passed since last update.

Dockerコンテナから、同一ホストマシンのPostgresqlに接続できるようにする(CentOS7)

Last updated at Posted at 2019-10-01

Dockerコンテナから、(コンテナを起動している)ホストで起動しているPostgresqlに接続できなかった時に試行錯誤した備忘録的なやつ。

前提

  • Dockerネットワークはデフォルト(bridge)で起動する
  • Postgresqlの接続設定をやったけど動かなかった

環境

  • CentOS 7.6
  • Postgres Server 9.2.24
  • Docker 1.13.1

結論

firewalldにPostgresqlを追加する。

# firewall-cmd --zone=public --add-service=postgresql
# firewall-cmd --reload

1個目のfirewall-cmdコマンドに--permanentオプションをつけるとOSを再起動しても設定が継続する。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0