When I start my stack, the pgadmin container tells the error Permission denied: '/var/lib/pgadmin/sessions'
- full message
ERROR : Failed to create the directory /var/lib/pgadmin/sessions: [Errno 13] Permission denied: '/var/lib/pgadmin/sessions' HINT : Create the directory /var/lib/pgadmin/sessions, ensure it is writeable by 'pgadmin', and try again, or, create a config_local.py file and override the SESSION_DB_PATH setting per https://www.pgadmin.org/docs/pgadmin4/9.4/config_py.html [2024-05-31 23:15:34 +0000] [1] [ERROR] Worker (pid:118) exited with code 1 [2024-05-31 23:15:34 +0000] [1] [ERROR] Worker (pid:118) exited with code 1. [2024-05-31 23:15:34 +0000] [119] [INFO] Booting worker with pid: 119 /venv/lib/python3.12/site-packages/passlib/pwd.py:16: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. import pkg_resources [2024-05-31 23:15:40 +0000] [119] [INFO] Worker exiting (pid: 119) ERROR : Failed to create the directory /var/lib/pgadmin/sessions: [Errno 13] Permission denied: '/var/lib/pgadmin/sessions' HINT : Create the directory /var/lib/pgadmin/sessions, ensure it is writeable by 'pgadmin', and try again, or, create a config_local.py file and override the SESSION_DB_PATH setting per https://www.pgadmin.org/docs/pgadmin4/9.4/config_py.html [2024-05-31 23:15:41 +0000] [1] [ERROR] Worker (pid:119) exited with code 1 [2024-05-31 23:15:41 +0000] [1] [ERROR] Worker (pid:119) exited with code 1.
- my docker compose
services: pgadmin_storedb: image: dpage/pgadmin4 container_name: pgadmin_storedb restart: always ports: - "5050:80" environment: PGADMIN_DEFAULT_EMAIL: [email protected] PGADMIN_DEFAULT_PASSWORD: P@ssw0rd volumes: - ./pgadmin-data:/var/lib/pgadmin networks: - store_network extra_hosts: - "host.docker.internal:host-gateway"
Solution
- changed a port in my docker-compose
- I changed a port in my docker-compose from
services: pgadmin_storedb: image: dpage/pgadmin4 container_name: pgadmin_storedb restart: always ports: - "5051:80" environment: PGADMIN_DEFAULT_EMAIL: [email protected] PGADMIN_DEFAULT_PASSWORD: P@ssw0rd volumes: - ./pgadmin-data:/var/lib/pgadmin networks: - store_network extra_hosts: - "host.docker.internal:host-gateway"
to
services: pgadmin_storedb: image: dpage/pgadmin4 container_name: pgadmin_storedb restart: always ports: - "5051:5050" environment: PGADMIN_DEFAULT_EMAIL: [email protected] PGADMIN_DEFAULT_PASSWORD: P@ssw0rd PGADMIN_LISTEN_PORT: 5050 volumes: - ./pgadmin-data:/var/lib/pgadmin networks: - store_network extra_hosts: - "host.docker.internal:host-gateway"
If the Problem still exists, check the host path permission
- Check the host path and set the directory's UID and GID to be
5050
sudo chown -R 5050:5050 ${DATA_PATH_PG_ADMIN_HOST} ls -l ${DATA_PATH_PG_ADMIN_HOST}
If you don't care about security, you can grant (777)
- On Synology, you can grant everyone read/write on the specific path
${DATA_PATH_PG_ADMIN_HOST}

Reference
Discover more from naiwaen@DebuggingSoft
Subscribe to get the latest posts sent to your email.