Repository navigation
User does not have CONNECT privilege. #584
Copy link
Copy link
Closed
Labels
questionUsability question, not directly related to an error with the imageUsability question, not directly related to an error with the image
Description
I always get the following error when trying to containerise with docker-compose:
SQLSTATE[08006] [7] FATAL: permission denied for database "nextcloud" DETAIL: User does not have CONNECT privilege.
My docker-compose looks like the following:
version: '3'
services:
proxy:
image: budry/jwilder-nginx-proxy-arm:latest
labels:
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
container_name: nextcloud-proxy
networks:
- nextcloud_network
ports:
- 80:80
- 443:443
volumes:
- ./proxy/conf.d:/etc/nginx/conf.d:rw
- ./proxy/vhost.d:/etc/nginx/vhost.d:rw
- ./proxy/html:/usr/share/nginx/html:rw
- ./proxy/certs:/etc/nginx/certs:ro
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
restart: unless-stopped
letsencrypt:
image: budry/jrcs-letsencrypt-nginx-proxy-companion-arm
container_name: nextcloud-letsencrypt
depends_on:
- proxy
networks:
- nextcloud_network
volumes:
- ./proxy/certs:/etc/nginx/certs:rw
- ./proxy/vhost.d:/etc/nginx/vhost.d:rw
- ./proxy/html:/usr/share/nginx/html:rw
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
restart: unless-stopped
db:
image: postgres
container_name: nextcloud-postgres
networks:
- nextcloud_network
environment:
POSTGRES_PASSWORD: TEST
POSTGRES_USER: nextcloud
POSTGRES_DB: nextcloud
PGDATA: /var/lib/psql/data
volumes:
- db:/var/lib/psql
- /etc/localtime:/etc/localtime:ro
restart: unless-stopped
app:
image: nextcloud:latest
container_name: nextcloud-app
networks:
- nextcloud_network
depends_on:
- letsencrypt
- proxy
- db
volumes:
- nextcloud:/var/www/html
- ./app/config:/var/www/html/config
- ./app/custom_apps:/var/www/html/custom_apps
- ./app/data:/var/www/html/data
- ./app/themes:/var/www/html/themes
- /etc/localtime:/etc/localtime:ro
environment:
- VIRTUAL_HOST=192.168.0.118
- LETSENCRYPT_HOST=192.168.0.118
- LETSENCRYPT_EMAIL=moritz@develapp.me
restart: unless-stopped
volumes:
nextcloud:
db:
networks:
nextcloud_network:
I also tried different versions and standard configuration from Postgres (with postgres User) but all the time the same error occurs.
Metadata
Metadata
Assignees
Labels
questionUsability question, not directly related to an error with the imageUsability question, not directly related to an error with the image
Activity
wglambert commentedon May 23, 2019
The environment variables are only applied if the data directory is empty, as they are used during and initialization.
https://github.com/docker-library/docs/tree/master/postgres#environment-variables
So you'd have to manually do that configuration on your database, or run a script using the
/docker-entrypoint-initdb.d/to apply any modificationshttps://github.com/docker-library/docs/tree/master/postgres#initialization-scripts
Mojo90 commentedon May 24, 2019
So it is the same with a fresh new build.
I also logged in to the postgres container and removed the data directory and restarted the container --> same error.
I also logged in to the postgres container and added manually the connect privilege with
--> same error.
So really not sure what's going on here and why this error persists.
wglambert commentedon May 24, 2019
When you do a
docker restartthe entrypoint isn't run again as it's only when a container is started for the first time (otherwise everydocker stop/startorrestartwould re-initialize the container and wipe it)For manually adding privileges to the database
Making a new container to connect to the first one using the created user and database
Mojo90 commentedon May 27, 2019
Yes, I did it like that beforehand and that worked.
But what I am wondering is: why do I have the chance to add the credentials as environment variables, but it is not added accordingly to the psql server? Or even when I add nothing it does not work with standard credentials (postgres / postgres) as mentioned. That is a bit weird.
wglambert commentedon May 28, 2019
The env var configuration is done through the entrypoint, which only runs once when the container is first initialized. The env vars are only used if the entrypoint itself initializes the database, if one is already present then nothing is changed.
https://github.com/docker-library/postgres/blob/master/11/docker-entrypoint.sh
If you set nothing then the entrypoint only allows local connections (unix socket) and the Postgres user will have no password
wglambert commentedon May 31, 2019
Going to close since this looks resolved
charlag commentedon Jun 7, 2019
Hi
I believe there's still something wrong there
I delete volume and files and start docker-compose, I see that init sequence is run but I still cannot connect.
docker-compose logs
(there was another thing for some reason where password did not match, I did
\passwordmanually, now we have the same privilege error)Doing
GRANT CONNECT ON DATABASE nextcloud TO nextcloud;does not help.I use derived arm32v7/postgres images if it makes a difference.
charlag commentedon Jun 7, 2019
Uuuf, sorry, it seems to be realted to nextcloud/server#11311