使用镜像在 Docker 容器中运行 pgAdmin 4.2.0 dpage/pgadmin4,我注意到服务器连接没有被保存。
容器是使用卷映射创建的:
./data/pgadmin:/root/.pgadmin
Run Code Online (Sandbox Code Playgroud)
当docker容器重新启动时,或者当用户重新登录仪表板时,所有先前输入的服务器连接详细信息都会消失。
如何确保正确保存连接详细信息?
我使用以下图像https://hub.docker.com/r/dpage/pgadmin4/在 Ubuntu 18-04 上设置 pgAdmin4。
我已经安装了一个包含文件的卷pgpass(该文件也chmod供pgadmin容器内的用户使用),如您在我的 Compose 文件中看到的那样:
version: '3.8'
services:
pgadmin4:
image: dpage/pgadmin4
container_name: pgadmin4
environment:
- PGADMIN_DEFAULT_EMAIL=me@localhost
- PGADMIN_DEFAULT_PASSWORD=******************
- PGADMIN_LISTEN_PORT=5050
- PGADMIN_SERVER_JSON_FILE=servers.json
volumes:
- ./config/servers.json:/pgadmin4/servers.json # <-- this file is well taken into account
- ./config/pgpass:/pgpass # <- there is no way to find this one on the other hand
ports:
- "5000:5000"
restart: unless-stopped
network_mode: host
Run Code Online (Sandbox Code Playgroud)
但是,当我右键单击服务器并检查其高级属性时,pgadmin 网页似乎无法识别它:
如果我/pgpass在顶部绿色框中手动指定图像中只有斜杠的位置,则会显示:
但是如果我登录到容器,我实际上可以列出该文件:
/ $ ls -larth /pgpass
-rw------- …Run Code Online (Sandbox Code Playgroud)