# Temporary failure in name resolution – Error when containerA uses containerB.internal as database host

**URL:** <https://community.fly.io/t/temporary-failure-in-name-resolution-error-when-containera-uses-containerb-internal-as-database-host/7318>\
**Category:** Build debugging\
**Tags:** mysql\
**Created:** [September 21, 2022, 4:22pm UTC](https://community.fly.io/t/temporary-failure-in-name-resolution-error-when-containera-uses-containerb-internal-as-database-host/7318 "2022-09-21T16:22:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DesignByAdrian](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/designbyadrian/32/5642_2.png) [@DesignByAdrian](https://community.fly.io/u/DesignByAdrian)\
**Post date:** [September 21, 2022, 4:22pm UTC](https://community.fly.io/t/temporary-failure-in-name-resolution-error-when-containera-uses-containerb-internal-as-database-host/7318/1 "2022-09-21T16:22:33Z")

</div>

Hello, I have no idea what I’m doing wrong! 🥲

I’m running Wordpress in one container, and Maria DB in another.

Wordpress is incredibly slow and also often just redirects to a **Error establishing a database connection** screen with the following debug message:

```auto
Warning: mysqli_real_connect(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /var/www/html/wp-includes/wp-db.php on line 1753 Warning: mysqli_real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /var/www/html/wp-includes/wp-db.php on line 1753

php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

```

I was hoping for an easy setup and not really sure what I’m doing but these are my two toml files:

Wordpress:

```auto
# fly.toml file generated for ias on 2022-09-13T17:29:38+02:00

app = "ias"
kill_signal = "SIGINT"
kill_timeout = 5

[mounts]
  source = "ias_wp_content"
  destination = "/var/www/html"

[env]
  WORDPRESS_DB_HOST = "wp-maria.internal"
  WORDPRESS_DB_NAME = "wordpress"
  WORDPRESS_DB_USER = REDACTED
  WORDPRESS_TABLE_PREFIX = "ias_"
  WORDPRESS_DEBUG = 1

[build]
  image = "designbyadrian/wordpress:php7.4-apache-amd"

[[services]]
  internal_port = 80
  protocol = "tcp"
  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

```

DB:

```auto
# fly.toml file generated for wp-maria on 2022-09-13T16:41:11+02:00

app = "wp-maria"
kill_signal = "SIGINT"
kill_timeout = 5

[mounts]
  source = "mariadata"
  destination = "/data"

[env]
  MARIADB_DATABASE = "wordpress"
  MARIADB_USER = REDACTED

[build]
  image = "mariadb:10"

[experimental]
  cmd = [
    "--datadir","/data/maria"
  ]

```

In [this post](https://community.fly.io/t/wordpress-often-loses-database-connection-mariadb-on-its-own-container/7213/16), I’ve with help figured out that the two containers _can_ talk to each other, but something is just off.

---

<div class="post-metadata">

**Author:** ![eli](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/eli/32/49867_2.png) [@eli](https://community.fly.io/u/eli)\
**Post date:** [September 21, 2022, 7:10pm UTC](https://community.fly.io/t/temporary-failure-in-name-resolution-error-when-containera-uses-containerb-internal-as-database-host/7318/2 "2022-09-21T19:10:54Z")

</div>

Thanks for linking to the previous topic! I’m glad to see that you’ve confirmed that your db is listening on IPv6 for the correct port.This is by far the most common cause of .internal DNS woes 😅

Since you can connect to the database via mysql, it would initially seem like the Fly platform settings and behavior is working correctly.

Checking the wp-db docs for mysqli specifically, I think it’s possible that you might be running into a Wordpress issue? I found this thread, which might be a good jumping-off point:

- [mysql - Connect to Wordpress database with ipv6 host - Stack Overflow](https://stackoverflow.com/questions/44847606/connect-to-wordpress-database-with-ipv6-host)

---

<div class="post-metadata">

**Author:** ![DesignByAdrian](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/designbyadrian/32/5642_2.png) [@DesignByAdrian](https://community.fly.io/u/DesignByAdrian)\
**Post date:** [September 22, 2022, 5:22pm UTC](https://community.fly.io/t/temporary-failure-in-name-resolution-error-when-containera-uses-containerb-internal-as-database-host/7318/3 "2022-09-22T17:22:03Z")

</div>

Currently, I’ve got this line:

`WORDPRESS_DB_HOST = "wp-maria.internal"`

Are you saying that I should write something like

`WORDPRESS_DB_HOST = "fe80::ec4:XXXX:XXXX:XXXX"` instead?

There were no IP addresses on the DB container, so I assigned one with `flyctl ips allocate-v6` and modified the DB\_HOST variable. The site didn’t load properly at all and went straight to the database error page after a few seconds of delay ☹

But sporting the new IPV6 IP, I reverted the change to the WP container, and I seem to be able to use it just fine! 🙂 I’ll keep a look out for more issues for now.

Why would this make a difference? Should I assign a V4 IP as well?

---

<div class="post-metadata">

**Author:** ![DesignByAdrian](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/designbyadrian/32/5642_2.png) [@DesignByAdrian](https://community.fly.io/u/DesignByAdrian)\
**Post date:** [September 22, 2022, 5:34pm UTC](https://community.fly.io/t/temporary-failure-in-name-resolution-error-when-containera-uses-containerb-internal-as-database-host/7318/4 "2022-09-22T17:34:10Z")

</div>

Update: it’s fast for every few clicks, then a slow load but displays the page.

I could use it for a while, but now back to the same issue ☹

---

<div class="post-metadata">

**Author:** ![DesignByAdrian](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/designbyadrian/32/5642_2.png) [@DesignByAdrian](https://community.fly.io/u/DesignByAdrian)\
**Post date:** [September 27, 2022, 7:55am UTC](https://community.fly.io/t/temporary-failure-in-name-resolution-error-when-containera-uses-containerb-internal-as-database-host/7318/5 "2022-09-27T07:55:33Z")

</div>

I’ve been trying to figure out what the post you linked would solve in the first place… 🤔
