问题描述
在此帖子,但位于docker容器中.我真的不知道pgadmin文件位于何处以编辑它的默认路径.如何解决此问题?请尽可能详细,因为我不知道如何使用Docker.
I have got the same problem described in this post, but inside a docker container.I don't really know where my pgadmin file reside to edit it's default path.How do I go about fixing this issue? Please be as detailed as possible because I don't know how to docker.
以下是 docker-compose up
命令的逐字记录的摘要:
Here is an abstract of the verbatim of docker-compose up
command:
php-worker_1 | 2020-11-11 05:50:13,700 INFO spawned: 'laravel-worker_03' with pid 67
pgadmin_1 | [2020-11-11 05:50:13 +0000] [223] [INFO] Worker exiting (pid: 223)
pgadmin_1 | WARNING: Failed to set ACL on the directory containing the configuration database:
pgadmin_1 | [Errno 1] Operation not permitted: '/var/lib/pgadmin'
pgadmin_1 | HINT : You may need to manually set the permissions on
pgadmin_1 | /var/lib/pgadmin to allow pgadmin to write to it.
pgadmin_1 | ERROR : Failed to create the directory /var/lib/pgadmin/sessions:
pgadmin_1 | [Errno 13] Permission denied: '/var/lib/pgadmin/sessions'
pgadmin_1 | HINT : Create the directory /var/lib/pgadmin/sessions, ensure it is writeable by
pgadmin_1 | 'pgadmin', and try again, or, create a config_local.py file
pgadmin_1 | and override the SESSION_DB_PATH setting per
pgadmin_1 | https://www.pgadmin.org/docs/pgadmin4/4.27/config_py.html
pgadmin_1 | /usr/local/lib/python3.8/os.py:1023: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
pgadmin_1 | return io.open(fd, *args, **kwargs)
pgadmin_1 | [2020-11-11 05:50:13 +0000] [224] [INFO] Booting worker with pid: 224
我的docker-compose.yml:
my docker-compose.yml:
### pgAdmin ##############################################
pgadmin:
image: dpage/pgadmin4:latest
environment:
- "PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL}"
- "PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD}"
ports:
- "${PGADMIN_PORT}:80"
volumes:
- ${DATA_PATH_HOST}/pgadmin:/var/lib/pgadmin
depends_on:
- postgres
networks:
- frontend
- backend
推荐答案
好的.当您尝试运行 pgadmin
服务时,似乎出现了问题.
Okay. looks like problem appears when you try to run pgadmin
service.
这部分
### pgAdmin ##############################################
pgadmin:
image: dpage/pgadmin4:latest
environment:
- "PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL}"
- "PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD}"
ports:
- "${PGADMIN_PORT}:80"
volumes:
- ${DATA_PATH_HOST}/pgadmin:/var/lib/pgadmin
depends_on:
- postgres
networks:
- frontend
- backend
如您所见,您尝试将本地目录 $ {DATA_PATH_HOST}/pgadmin
装入容器的/var/lib/pgadmin
As you can see you trying to mount local directory ${DATA_PATH_HOST}/pgadmin
into container's /var/lib/pgadmin
volumes:
- ${DATA_PATH_HOST}/pgadmin:/var/lib/pgadmin
您可以在文章中阅读您本地的 $ {DATA_PATH_HOST}/pgadmin
目录的UID和GID必须为 5050
.这是 5050
吗?
As you can read in this article your local ${DATA_PATH_HOST}/pgadmin
directory's UID and GID must be 5050
. Is this 5050
?
您可以通过运行进行检查
You can check it by running
ls -l ${DATA_PATH_HOST}
输出将类似于
drwxrwxr-x 1 5050 5050 12693 Nov 11 14:56 pgadmin
或
drwxrwxr-x 1 SOME_USER SOME_GROUP 12693 Nov 11 14:56 pgadmin
如果 SOME_USER
和 SOME_GROUP
的ID为 5050
,则可以. 5050
也可以.如果没有,请尝试按照上述文章中的说明进行操作.
if SOME_USER
's and SOME_GROUP
's IDs are 5050
, it is okay. 5050
as is also okay. If not, try to do as described in article above.
sudo chown -R 5050:5050 ${DATA_PATH_HOST}/pgadmin
还需要检查环境变量是否存在:
Also you need to check is environment variable exists:
# run it as same user as you running docker-compose
echo ${DATA_PATH_HOST}
如果输出为空,则需要设置 $ {DATA_PATH_HOST}
或允许docker从文件中读取变量.有很多方法可以做到这一点.
If output will be empty you need to set ${DATA_PATH_HOST}
or allow docker to read variables from file. There are many ways to do it.
这篇关于权限被拒绝:Docker中的'/var/lib/pgadmin/sessions'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!