Discourse docker container has trouble reaching DNS

I have a problem with installation Discourse on ec2 AWS instance ubuntu 18.04.
I took ami-22741f5a from Ubuntu Amazon EC2 AMI Finder.
installed docker sudo apt-get install docker.io

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

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

1 Like

Somehow your location is unable to connect to github.

@sam I can resolve host from host machine

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

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

2 Likes

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

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?

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?

@sam I can get internet by IP adress

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?

You can see some documentation here:

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

The option you are looking to set is --dns

3 Likes

@sam I tried to ping with this command

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?

This may help! if You haven’t create a security group for your EC2 instance and allow Destination connections
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html

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

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

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