# Curl can't resolve host: img.youtube.com

**URL:** https://community.kinsta.com/t/curl-cant-resolve-host-img-youtube-com/1895
**Category:** Bug Reports
**Created:** [November 22, 2022, 10:34pm UTC](https://community.kinsta.com/t/curl-cant-resolve-host-img-youtube-com/1895 "2022-11-22T22:34:47Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![andergmartins](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/andergmartins/32/1656_2.png) [@andergmartins](https://community.kinsta.com/u/andergmartins)
#### Post date: [November 22, 2022, 10:34pm UTC](https://community.kinsta.com/t/curl-cant-resolve-host-img-youtube-com/1895/1 "2022-11-22T22:34:47Z")

</div>

**Q: Date/Time this occurred (Provide your time zone also)**  
**A:** Discovered this on 22 Nov 2022, 15:00, Sao Paulo, BR time.

**Q: DevKinsta Version**  
**A:** 2.8.0

**Q: OS Version**  
**A:** MacOS Monterey, 12.6 (Running on M1 machine)

**Q: Docker Desktop Version**  
**A:** v4.13.1

**Q: Were any error codes or messages observed? If so, what were they?**  
**A:** curl: (6) Could not resolve host: [img.youtube.com](http://img.youtube.com)

**Q: Detailed Description of the Problem**  
**A:** We have a script that calls the url [https://img.youtube.com](https://img.youtube.com) to retrieve the thumbnail of specific youtube videos for the user. But we can’t make the request to that URL using PHP, or even curl in the bash.

I can replicate this on bash and PHP. Here is a snippet how to replicate it using curl in bash:

```bash
docker exec -it devkinsta_fpm bash

```

```bash
curl -L https://img.youtube.com/vi/1YyO12WGju0/0.jpg
curl: (6) Could not resolve host: img.youtube.com

```

But if I call the domain that redirects to `www` I get the same error:

```bash
curl -L https://youtube.com
curl: (6) Could not resolve host: www.youtube.com

```

If I try another domain, like:

```bash
curl -L https://metaslider.com
<it outputs the source code correctly>

```

and

```bash
curl -L https://www.metaslider.com
<it outputs the source code correctly>

```

It seems to be related to DNS. The content of `/etc/resolv.conf` is the following:

```auto
nameserver 127.0.0.11
options ndots:0

```

If I change to:

```auto
nameserver 8.8.8.8
options ndots:0

```

Those requests to youtube start working, but of course the local sites’ domains stop working.

I’m able to make requests to `img.youtube.com` from another custom docker container, but not from inside the `devkinsta_fpm`.

 ![Screen Shot 2022-11-22 at 19.34.29](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/4/4160ac82c508d87c8452d3a495d3f46ce3ae061d.png)

---

<div class="post-metadata">

### Author: ![Kevin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/kevin/32/808_2.png) [@Kevin](https://community.kinsta.com/u/Kevin)
#### Post date: [November 22, 2022, 10:53pm UTC](https://community.kinsta.com/t/curl-cant-resolve-host-img-youtube-com/1895/2 "2022-11-22T22:53:53Z")

</div>

Hi @andergmartins, thank you very much for the clear report and testing done here. Something similar came up in [this thread](https://community.kinsta.com/t/unable-to-resolve-host-address-storage-googleapis-com/1717) without a solution that applies to what you are experiencing; that started an internal discussion about the DNS resolver we are using for DevKinsta. I’ll make sure the devs take a look at your findings/see if there’s a quick fix.

---

<div class="post-metadata">

### Author: ![andergmartins](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/andergmartins/32/1656_2.png) [@andergmartins](https://community.kinsta.com/u/andergmartins)
#### Post date: [November 23, 2022, 2:29pm UTC](https://community.kinsta.com/t/curl-cant-resolve-host-img-youtube-com/1895/3 "2022-11-23T14:29:17Z")

</div>

Hi @Kevin cool, thank you for the quick feedback. Yeah, that issue looks similar, sorry, I missed that one and created another thread here.

I will be glad to help. Please, could you, or the devs, give me a little more information about the DNS resolver used on DevKinsta? Which one, or where can I find it inside the container so I can try helping debugging or fixing that?

---

<div class="post-metadata">

### Author: ![andergmartins](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/andergmartins/32/1656_2.png) [@andergmartins](https://community.kinsta.com/u/andergmartins)
#### Post date: [November 23, 2022, 2:34pm UTC](https://community.kinsta.com/t/curl-cant-resolve-host-img-youtube-com/1895/4 "2022-11-23T14:34:51Z")

</div>

Is it related to the `devkinsta_nginx` container?

---

<div class="post-metadata">

### Author: ![andergmartins](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/andergmartins/32/1656_2.png) [@andergmartins](https://community.kinsta.com/u/andergmartins)
#### Post date: [November 23, 2022, 2:42pm UTC](https://community.kinsta.com/t/curl-cant-resolve-host-img-youtube-com/1895/5 "2022-11-23T14:42:41Z")

</div>

Oh, I found it when listing the `devkinsta_fpm` container’s processes.

It is `shaman`, and is running as the service `dns_server`.

I just tried doing the following:

```bash
dns_server list

```

And it displayed only the local domains I have on DevKinsta:

```bash
["php-74-dev.local","php-81-dev.local","php-80-dev.local"]

```

So I tried updating the register for the specific domain I need, running the command:

```bash
dns_server update -d img.youtube.com

```

It returned:

```json
{"domain":"img.youtube.com.","records":[{"ttl":60,"class":"IN","type":"A","address":""}]}

```

And that worked! The local DNS server is able to find that domain.

Now it recognizes the domain and I can know run:

```bash
curl -L https://img.youtube.com/vi/1YyO12WGju0/0.jpg

```

And it returns the correct answer when doing the request throw PHP as well.

This is probably a temporary solution, but works for me for now.

I will comment on that other ticket, since I suppose that might help on that too.

Thanks

---

<div class="post-metadata">

### Author: ![Agus](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/agus/32/1515_2.png) [@Agus](https://community.kinsta.com/u/Agus)
#### Post date: [November 28, 2022, 9:18am UTC](https://community.kinsta.com/t/curl-cant-resolve-host-img-youtube-com/1895/6 "2022-11-28T09:18:10Z")

</div>

Hello @andergmartins , Agus here 👋  
Thank you for your reply and the details of the workaround you provided which worked well for you - so that the default DNS resolver ( `shaman` ) we use finally recognizes that hostname/sub-domain.

I was able to replicate this issue on my **Windows machine** (Win 10 pro) and was able to resolve it with your solution above 👏

 ![dns_server_update_-d_hostname_windows_10](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/e/ea0ef682fabfc923734f154eafd4466707fa1673.png)

though on my **Linux laptop** the local DNS resolver could resolve/recognize that same hostname/sub-domain just fine (without adding that `dns_server update -d img.youtube.com` line ).

 ![dns_server_linux](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/6/61164f97ea9342c51a757a14fabdbc270f06c3f0.png)

I will mark your reply above as a solution now! Thank you for your reply on the other ticket as well!

PS: @Kevin is not available at the moment, but last week I talked with him as well about this internally with our Devs team, and will surely let them know about this solution as well! 👍

---

<div class="post-metadata">

### Author: ![andergmartins](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/andergmartins/32/1656_2.png) [@andergmartins](https://community.kinsta.com/u/andergmartins)
#### Post date: [November 28, 2022, 5:19pm UTC](https://community.kinsta.com/t/curl-cant-resolve-host-img-youtube-com/1895/7 "2022-11-28T17:19:34Z")

</div>

Sure, no problem. Thanks

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/8/80f8c4e56fecc02327a0964e6bf63a716483529f.png) [@system](https://community.kinsta.com/u/system)
#### Post date: [December 1, 2022, 5:20pm UTC](https://community.kinsta.com/t/curl-cant-resolve-host-img-youtube-com/1895/8 "2022-12-01T17:20:09Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
