Closed ocidserver closed 1 week ago
Do you have the hostname and port right for your database server? That error means it can't reach it. Especially with Docker compose, it's important to make sure you're using the right hostname.
i use this
services:
app:
depends_on:
- db
environment:
PRETTY_URLS: "1"
HTTPS: "0"
HTTPS_REDIRECT: "0"
LANG: "en-US"
DB_TYPE: "mysql"
DB_HOST: "db"
DB_PORT: "3306"
DB_USER: "webtrees"
DB_PASS: "baddbpassword"
DB_NAME: "webtrees"
DB_PREFIX: "wt_"
WT_USER: "admin"
PUID: "1000"
PGID: "1000"
image: ghcr.io/nathanvaughn/webtrees:latest
ports:
- 8700:80
# - 443:443
restart: unless-stopped
volumes:
# - ~/certs:/certs/
- app_data:/var/www/webtrees/data/
db:
environment:
MARIADB_DATABASE: "webtrees"
MARIADB_USER: "webtrees"
MARIADB_ROOT_PASSWORD: "badrootpassword"
MARIADB_PASSWORD: "baddbpassword"
# See: https://github.com/NathanVaughn/webtrees-docker/issues/145
image: docker.io/library/mariadb:11
restart: unless-stopped
volumes:
- db_data:/var/lib/mysql
# db:
# environment:
# POSTGRES_DB: "webtrees"
# POSTGRES_USER: "webtrees"
# POSTGRES_PASSWORD: "badpassword"
# image: docker.io/library/postgres:latest
# restart: unless-stopped
# volumes:
# - db_data:/var/lib/postgresql/data
volumes:
db_data:
driver: local
app_data:
driver: local
I tried that docker-compose stack and had no issues. What you can do is attach a shell to the container and check the contents of /var/www/webtrees/data/config.ini.php
Additionally, run mysqladmin
and see if the container can even reach the database.
Or install ping
and check that the database is responding that way:
apt update
apt install iputils-ping
ping db
already try to inspect in console, im try to connect db from dbeaver and no issue. i use portainer to manage network, its already in the same network.
already solve, im try to re-run docker compose. i think this way will erase all db, but its all safe. thx dude
i got this error after running well for a week. accidentaly crash and cannot get in to. container become unhealty on portainer. help me to solve
RuntimeException: SQLSTATE[HY000] [2002] No route to host in /var/www/webtrees/app/Http/Middleware/UseDatabase.php:119