containers
containers copied to clipboard
[bitnami/moodle] Can't connect to Postgres database
Name and Version
bitnami/moodle:4.0.0
What steps will reproduce the bug?
- Create new Postgres DB via pgadmin4 called moodle
- Setup portainer with the following settings
version: '2'
services:
moodle:
image: bitnami/moodle:latest
ports:
- 8080:8080
- 8443:8443
environment:
- MOODLE_DATABASE_TYPE=pgsql
- MOODLE_DATABASE_PORT_NUMBER=5432
- MOODLE_DATABASE_HOST=localhost
- MOODLE_DATABASE_USER=postgres
- MOODLE_DATABASE_PASSWORD=hidden
- MOODLE_DATABASE_NAME=moodle
volumes:
- moodle:/bitnami/moodle
- moodle_data:/bitnami/moodledata
volumes:
moodle:
moodle_data:
- Update/deploy the stack
What is the expected behavior?
I would expect it to create the database. I works fine with with mariadb deployed in the stack.
What do you see instead?
Output:
moodle 05:40:10.63
moodle 05:40:10.63 Welcome to the Bitnami moodle container
moodle 05:40:10.63 Subscribe to project updates by watching https://github.com/bitnami/containers
moodle 05:40:10.63 Submit issues and feature requests at https://github.com/bitnami/containers/issues
moodle 05:40:10.63
moodle 05:40:10.63 INFO ==> ** Starting Moodle setup **
realpath: /bitnami/apache/conf: No such file or directory
moodle 05:40:10.66 INFO ==> Configuring Apache ServerTokens directive
moodle 05:40:10.69 INFO ==> Configuring PHP options
moodle 05:40:10.69 INFO ==> Setting PHP expose_php option
moodle 05:40:10.71 INFO ==> Validating settings in MYSQL_CLIENT_* env vars
moodle 05:40:10.71 INFO ==> Validating settings in POSTGRESQL_CLIENT_* env vars
moodle 05:40:10.78 INFO ==> Ensuring Moodle directories exist
moodle 05:40:10.80 INFO ==> Trying to connect to the database server
moodle 05:41:10.88 ERROR ==> Could not connect to the database
Additional information
No response
Hi @mickkn
Could you check if the description is correct? I edited it to use properlyGitHub markdown. Please use it to apply a readable format in your comments, mainly if you are pasting code, console output or logs.
Please note that MOODLE_DATABASE_HOST=localhost
make reference to your container, not your physical host
This container is a community-supported solution. This means that the Bitnami team is not actively working on new features/improvements nor providing support through GitHub Issues for this container. Any new issue will stay open for 20 days to allow the community to contribute, after 15 days without activity the issue will be marked as stale being closed after 5 days.
The Bitnami team will review any PR that is created, feel free to create a PR if you find any issue or want to implement a new feature.
Hi @mickkn
Could you check if the description is correct? I edited it to use properlyGitHub markdown. Please use it to apply a readable format in your comments, mainly if you are pasting code, console output or logs.
Please note that
MOODLE_DATABASE_HOST=localhost
make reference to your container, not your physical host
Thanks. Actually wanted it to use an instance on the host PC.
Tried below solution, but it also doesn't work.
version: '3.8'
services:
postgres:
image: postgres
restart: unless-stopped
environment:
- POSTGRES_PASSWORD=password
- POSTGRES_USER=postgres
moodle:
image: bitnami/moodle:latest
ports:
- 8080:8080
- 8443:8443
environment:
- MOODLE_DATABASE_TYPE=pgsql
- MOODLE_DATABASE_PORT_NUMBER=5432
- MOODLE_DATABASE_HOST=postgres
- MOODLE_DATABASE_USER=postgres
- MOODLE_DATABASE_PASSWORD=password
- MOODLE_DATABASE_NAME=moodle
volumes:
- moodle:/bitnami/moodle
- moodle_data:/bitnami/moodledata
volumes:
moodle:
moodle_data:
Assuming that you are using docker, please have a look to the networking section
Assuming that you are using docker, please have a look to the networking section
Thanks. Yea, tried with the network_mode: host. Didn't solve it.
This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.
Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.