質問編集履歴

3

pg_hba.confを追記しました。

2020/02/20 14:08

投稿

june_223
june_223

スコア17

test CHANGED
File without changes
test CHANGED
@@ -136,6 +136,32 @@
136
136
 
137
137
 
138
138
 
139
+ ### pg_hba.conf
140
+
141
+
142
+
143
+ ```
144
+
145
+ # TYPE DATABASE USER ADDRESS METHOD
146
+
147
+
148
+
149
+ # "local" is for Unix domain socket connections only
150
+
151
+ local all all md5
152
+
153
+ # IPv4 local connections:
154
+
155
+ host all all 127.0.0.1/32 md5
156
+
157
+ # IPv6 local connections:
158
+
159
+ host all all ::1/128 md5
160
+
161
+ ```
162
+
163
+
164
+
139
165
 
140
166
 
141
167
  ### 試したこと

2

箇条書きの作業部分を追記しました

2020/02/20 14:08

投稿

june_223
june_223

スコア17

test CHANGED
File without changes
test CHANGED
@@ -4,27 +4,31 @@
4
4
 
5
5
  ホストOS:Mac
6
6
 
7
- ゲストOS:centOS7
7
+ ゲストOS:CentOS7
8
8
 
9
9
 
10
10
 
11
- ・MacのdocekrでcentOS7を立ち上げる。
11
+ ・MacのdocekrでCentOS7を立ち上げる。
12
12
 
13
- ・そのcentOS7にexecで入り、yumでPostgreSQLをインストール。
13
+ ・そのCentOS7にexecで入り、yumでPostgreSQLをインストール。
14
14
 
15
15
  ・PostgreSQLの初期設定とDBのリストアを完了。
16
16
 
17
- ・Postgresへのアドレスはlocalhost、ポートは5432と標準通りに設定。
17
+ ・PostgreSQLへのアドレスはlocalhost、ポートは5432と標準通りに設定。
18
18
 
19
- ・apacheなどweb系いろいろとインストールしてcakephpを立ち上げる。
19
+ ・apacheなどweb系いろいろとインストールしてCakePHPを立ち上げる。
20
20
 
21
21
  ・Macのsafariからcakephpへのアクセス可能。
22
+
23
+ ・postgresql-setup initdbをして、
24
+
25
+ ・pg_hba.conf と postgresql.confの諸設定も完了してCakePHPからPostgreSQLへの接続は正常接続できています
22
26
 
23
27
 
24
28
 
25
29
  とここまでは希望している動作ができたのですが、
26
30
 
27
- MacのpgAdmin4からdockerコンテナのホストOS(centOS7)のPostgreSQLにアクセスしたいのですが、設定方法がわかりません。
31
+ MacのpgAdmin4からdockerコンテナのホストOS(CentOS7)のPostgreSQLにアクセスしたいのですが、設定方法がわかりません。
28
32
 
29
33
 
30
34
 
@@ -146,7 +150,7 @@
146
150
 
147
151
 
148
152
 
149
- ホスト:macOS 10.14.6
153
+ ホスト:MacOS 10.14.6
150
154
 
151
155
  docker desktop version:2.2.0.3
152
156
 
@@ -154,4 +158,4 @@
154
158
 
155
159
 
156
160
 
157
- ゲスト:centOS7.7
161
+ ゲスト:CentOS7.7

1

Dockerfileとdocker-composer.ymlを追記しました。

2020/02/20 05:20

投稿

june_223
june_223

スコア17

test CHANGED
File without changes
test CHANGED
@@ -66,6 +66,72 @@
66
66
 
67
67
 
68
68
 
69
+ ### Dockerfile
70
+
71
+
72
+
73
+ ```
74
+
75
+ FROM centos:centos7
76
+
77
+
78
+
79
+ RUN yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm \
80
+
81
+ && yum install -y --enablerepo=remi-php55 php php-pdo_pgsql which wget git
82
+
83
+
84
+
85
+ RUN yum -y install postgresql-server
86
+
87
+ ```
88
+
89
+
90
+
91
+ ### docker-compose.yml
92
+
93
+
94
+
95
+ ```
96
+
97
+ version: '3'
98
+
99
+ services:
100
+
101
+ web:
102
+
103
+ container_name: centos7-apache24-php55
104
+
105
+ hostname: 'abcserver'
106
+
107
+ build:
108
+
109
+ context: .
110
+
111
+ dockerfile: ./Dockerfile
112
+
113
+ privileged: true
114
+
115
+ command: /sbin/init
116
+
117
+ volumes:
118
+
119
+ - .:/var/www/html:cached
120
+
121
+
122
+
123
+ ports:
124
+
125
+ - "5000:80"
126
+
127
+ - "5432:5432"
128
+
129
+
130
+
131
+ ```
132
+
133
+
134
+
69
135
 
70
136
 
71
137
  ### 試したこと