I'm trying to build a ruby rails docker-compose postgreSQL db with pgadmin4, but keep getting permission exception from the container. Even /bin/sh in the container returns the same error.
I'm using Ubuntu 18.04.3 LTS
Full log
db_1 |
db_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1 |
db_1 | LOG: database system was shut down at 2020-02-05 07:15:13 UTC
db_1 | LOG: MultiXact member wraparound protections are now enabled
db_1 | LOG: autovacuum launcher started
db_1 | LOG: database system is ready to accept connections
pgadmin_1 | [2020-02-05 07:15:17 +0000] [1] [INFO] Starting gunicorn 19.9.0
pgadmin_1 | [2020-02-05 07:15:17 +0000] [1] [INFO] Listening at: http://[::]:80 (1)
pgadmin_1 | [2020-02-05 07:15:17 +0000] [1] [INFO] Using worker: threads
pgadmin_1 | [2020-02-05 07:15:17 +0000] [13] [INFO] Booting worker with pid: 13
pgadmin_1 | [2020-02-05 07:15:17 +0000] [13] [ERROR] Exception in worker process
pgadmin_1 | Traceback (most recent call last):
pgadmin_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
pgadmin_1 | worker.init_process()
pgadmin_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 104, in init_process
pgadmin_1 | super(ThreadWorker, self).init_process()
pgadmin_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
pgadmin_1 | self.load_wsgi()
pgadmin_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
pgadmin_1 | self.wsgi = self.app.wsgi()
pgadmin_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
pgadmin_1 | self.callable = self.load()
pgadmin_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
pgadmin_1 | return self.load_wsgiapp()
pgadmin_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
pgadmin_1 | return util.import_app(self.app_uri)
pgadmin_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
pgadmin_1 | __import__(module)
pgadmin_1 | File "/pgadmin4/run_pgadmin.py", line 4, in <module>
pgadmin_1 | from pgAdmin4 import app
pgadmin_1 | File "/pgadmin4/pgAdmin4.py", line 109, in <module>
pgadmin_1 | app = create_app()
pgadmin_1 | File "/pgadmin4/pgadmin/__init__.py", line 350, in create_app
pgadmin_1 | paths.init_app(app)
pgadmin_1 | File "/pgadmin4/pgadmin/utils/paths.py", line 92, in init_app
pgadmin_1 | 'The user does not have permission to read and write to the '
pgadmin_1 | Exception: The user does not have permission to read and write to the specified storage directory.
pgadmin_1 | [2020-02-05 07:15:17 +0000] [13] [INFO] Worker exiting (pid: 13)
pgadmin_1 | [2020-02-05 07:15:17 +0000] [1] [INFO] Shutting down: Master
pgadmin_1 | [2020-02-05 07:15:17 +0000] [1] [INFO] Reason: Worker failed to boot.
***_pgadmin_1 exited with code 3
docker-compose.yml file
version: '3'
services:
db:
image: postgres:9.5
volumes:
- postgres:/var/lib/postgresql/data
pgadmin:
image: dpage/pgadmin4
volumes:
- pgadmin:/var/lib/pgadmin/storage
ports:
- '3030:80'
environment:
PGADMIN_DEFAULT_EMAIL: 'admin'
PGADMIN_DEFAULT_PASSWORD: password
depends_on:
- db
volumes:
postgres:
pgadmin:
(ruby rails services are removed because I don't think it's relevant)
revmoing the volumes in pgadmin container allows me to use /bin/sh in the container, but I can't use any command
I had the same problem. I could solve it by mounting the volume at a slightly different location:
volumes:
- pgadmin:/var/lib/pgadmin4/storage
Note that in your script it was mounted at /var/lib/pgadmin/storage
.