# Discourse docker container has trouble reaching DNS

**URL:** https://meta.discourse.org/t/discourse-docker-container-has-trouble-reaching-dns/86439
**Category:** Self-hosting
**Created:** [April 30, 2018, 7:06am UTC](https://meta.discourse.org/t/discourse-docker-container-has-trouble-reaching-dns/86439 "2018-04-30T07:06:01Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![yuri-zubov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yuri-zubov/32/95718_2.png) [@yuri-zubov](https://meta.discourse.org/u/yuri-zubov)
#### Post date: [April 30, 2018, 7:06am UTC](https://meta.discourse.org/t/discourse-docker-container-has-trouble-reaching-dns/86439/1 "2018-04-30T07:06:01Z")

</div>

I have a problem with installation Discourse on ec2 AWS instance ubuntu 18.04.  
I took [ami-22741f5a](https://console.aws.amazon.com/ec2/home?region=us-west-2#launchAmi=ami-22741f5a) from [Ubuntu Amazon EC2 AMI Finder](https://cloud-images.ubuntu.com/locator/ec2/).  
installed docker `sudo apt-get install docker.io`

```bash
docker version
Client:
 Version:	17.12.1-ce
 API version:	1.35
 Go version:	go1.10.1
 Git commit:	7390fc6
 Built:	Wed Apr 18 01:23:11 2018
 OS/Arch:	linux/amd64

Server:
 Engine:
  Version:	17.12.1-ce
  API version:	1.35 (minimum version 1.12)
  Go version:	go1.10.1
  Git commit:	7390fc6
  Built:	Wed Feb 28 17:46:05 2018
  OS/Arch:	linux/amd64
  Experimental:	false

```

when I tried to run `./launcher bootstrap app` I got

```plaintext
cd /pups && git pull && /pups/bin/pups --stdin
fatal: unable to access 'https://github.com/SamSaffron/pups.git/': Could not resolve host: github.com
fd2db3f069b7e4acf63e853409143403956ad61fd0d5bff9daaed96955af1f67
**FAILED TO BOOTSTRAP** please scroll up and look for earlier error messages, there may be more than one.

```

Also I installed ubuntu 18.04 on virtualbox manually and didn’t see this problem.  
Could you help me?  
thank you in advance

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 30, 2018, 7:16am UTC](https://meta.discourse.org/t/discourse-docker-container-has-trouble-reaching-dns/86439/2 "2018-04-30T07:16:13Z")

</div>

> [@yuri-zubov](#):
>
> Could not resolve host: [github.com](http://github.com)

Somehow your location is unable to connect to github.

---

<div class="post-metadata">

### Author: ![yuri-zubov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yuri-zubov/32/95718_2.png) [@yuri-zubov](https://meta.discourse.org/u/yuri-zubov)
#### Post date: [April 30, 2018, 7:19am UTC](https://meta.discourse.org/t/discourse-docker-container-has-trouble-reaching-dns/86439/3 "2018-04-30T07:19:24Z")

</div>

@sam I can resolve host from host machine

```plaintext
nslookup github.com
Server: 127.0.0.53
Address:	127.0.0.53#53

Non-authoritative answer:
Name:	github.com
Address: 192.30.255.113
Name:	github.com
Address: 192.30.255.112

```

also I made `git clone https://github.com/discourse/discourse_docker.git /var/discourse` to host machine

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 30, 2018, 7:22am UTC](https://meta.discourse.org/t/discourse-docker-container-has-trouble-reaching-dns/86439/4 "2018-04-30T07:22:51Z")

</div>

I guess something about your docker network config is blocking it… try doing this from `docker run -it ubuntu /bin/bash`

---

<div class="post-metadata">

### Author: ![yuri-zubov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yuri-zubov/32/95718_2.png) [@yuri-zubov](https://meta.discourse.org/u/yuri-zubov)
#### Post date: [April 30, 2018, 7:28am UTC](https://meta.discourse.org/t/discourse-docker-container-has-trouble-reaching-dns/86439/5 "2018-04-30T07:28:55Z")

</div>

yes, you absolutely right - I can not get access to internet from the container.

```plaintext
docker run -it ubuntu /bin/bash
root@656f47f21f17:/# apt-get update
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease                  
  Temporary failure resolving 'archive.ubuntu.com'

```

I think problem with DNS resolver. How to fix it?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 30, 2018, 7:31am UTC](https://meta.discourse.org/t/discourse-docker-container-has-trouble-reaching-dns/86439/6 "2018-04-30T07:31:10Z")

</div>

You can configure docker flags that set the DNS resolver for the docker service and restart the service. It should be using your system DNS but who knows maybe something is a bit broken with the docker install.

I suspect though this is the entire network being done vs just DNS, are you sure you can ping places?

---

<div class="post-metadata">

### Author: ![yuri-zubov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yuri-zubov/32/95718_2.png) [@yuri-zubov](https://meta.discourse.org/u/yuri-zubov)
#### Post date: [April 30, 2018, 7:42am UTC](https://meta.discourse.org/t/discourse-docker-container-has-trouble-reaching-dns/86439/7 "2018-04-30T07:42:22Z")

</div>

@sam I can get internet by IP adress

```plaintext
wget http://178.172.160.5
--2018-04-30 07:39:05-- http://178.172.160.5/
Connecting to 178.172.160.5:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://www.tut.by/ [following]
--2018-04-30 07:39:06-- https://www.tut.by/
Resolving www.tut.by (www.tut.by)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘www.tut.by’

```

Could you help me setup DNS settings for docker?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 30, 2018, 7:44am UTC](https://meta.discourse.org/t/discourse-docker-container-has-trouble-reaching-dns/86439/8 "2018-04-30T07:44:06Z")

</div>

You can see some documentation here:

[https://success.docker.com/article/how-do-i-set-the-docker-daemon-options](https://success.docker.com/article/how-do-i-set-the-docker-daemon-options)

> **[dockerd](https://docs.docker.com/reference/cli/dockerd/)**
>
> The daemon command description and usage

The option you are looking to set is `--dns`

---

<div class="post-metadata">

### Author: ![yuri-zubov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yuri-zubov/32/95718_2.png) [@yuri-zubov](https://meta.discourse.org/u/yuri-zubov)
#### Post date: [April 30, 2018, 8:29am UTC](https://meta.discourse.org/t/discourse-docker-container-has-trouble-reaching-dns/86439/10 "2018-04-30T08:29:27Z")

</div>

@sam I tried to ping with this command

```plaintext
sudo docker run --dns 8.8.8.8 --rm -it alpine ping -c 1 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes

--- 8.8.8.8 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss

```

You was right problem with network. Do you know how to fix?

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [April 30, 2018, 8:32am UTC](https://meta.discourse.org/t/discourse-docker-container-has-trouble-reaching-dns/86439/11 "2018-04-30T08:32:39Z")

</div>

This may help! if You haven’t create a security group for your EC2 instance and allow Destination connections

> **[Amazon EC2 security groups for your EC2 instances - Amazon Elastic Compute Cloud](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html)**
>
> Use security groups and security group rules as a firewall to control traffic to and from your EC2 instances.

---

<div class="post-metadata">

### Author: ![yuri-zubov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yuri-zubov/32/95718_2.png) [@yuri-zubov](https://meta.discourse.org/u/yuri-zubov)
#### Post date: [April 30, 2018, 9:05am UTC](https://meta.discourse.org/t/discourse-docker-container-has-trouble-reaching-dns/86439/12 "2018-04-30T09:05:55Z")

</div>

thank you for helping.  
on host machine didn’t work DNS-query

```plaintext
dig NS tut.by @8.8.8.8

; <<>> DiG 9.11.3-1ubuntu1-Ubuntu <<>> NS tut.by @8.8.8.8
;; global options: +cmd
;; connection timed out; no servers could be reached

```

I took ip address from networking interface and add to docker settings

```plaintext
dig NS tut.by @172.30.0.55

; <<>> DiG 9.11.3-1ubuntu1-Ubuntu <<>> NS tut.by @172.30.0.55
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10382
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;tut.by. IN	NS

;; ANSWER SECTION:
tut.by. 60	IN	NS	ns1.hosterby.com.
tut.by. 60	IN	NS	ns2.hosterby.com.

;; Query time: 48 msec
;; SERVER: 172.30.0.55#53(172.30.0.55)
;; WHEN: Mon Apr 30 09:04:58 UTC 2018
;; MSG SIZE rcvd: 83

```
