[wp-trac] [WordPress Trac] #58505: Using WORDPRESS_DB_HOST variable Cannot connect to the database, must be configu

WordPress Trac noreply at wordpress.org
Wed Apr 22 07:35:55 UTC 2026


#58505: Using WORDPRESS_DB_HOST variable Cannot connect to the database, must be
configu
--------------------------+------------------------------
 Reporter:  chentc        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  6.2.2
 Severity:  major         |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+------------------------------

Comment (by jdeep):

 Hi @chentc,

 I tried to reproduce the issue you were facing on Docker but couldn't. Can
 you share a bit more on what your configurations look like and how you set
 the `WORDPRESS_` env vars? If you could share your `docker-compose.yml` or
 Kubernetes manifests, that would be helpful.

 If I have to take a guess, I think your real issue is related to container
 networking. For example, if your database is running on Docker's default
 bridge network instead of a custom user-defined network, Docker's internal
 DNS won't automatically resolve container names. This means setting
 `WORDPRESS_DB_HOST` to a container name will fail, but using the raw
 database IP bypasses DNS entirely and connects
 successfully.[https://docs.docker.com/engine/network/drivers/bridge
 /#differences-between-user-defined-bridges-and-the-default-bridge See more
 here.]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58505#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list