Discourse docker container has trouble reaching DNS

(Yuri Zubov) #1

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
 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

  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
** 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

(Sam Saffron) #2

Somehow your location is unable to connect to github.

(Yuri Zubov) #3

@sam I can resolve host from host machine

nslookup github.com

Non-authoritative answer:
Name:	github.com
Name:	github.com

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

(Sam Saffron) #4

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

(Yuri Zubov) #5

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?

(Sam Saffron) #6

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?

(Yuri Zubov) #7

@sam I can get internet by IP adress

--2018-04-30 07:39:05--
Connecting to 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?

(Sam Saffron) #8

You can see some documentation here:


The option you are looking to set is --dns

Fatal: unable to access 'https://github.com/SamSaffron/pups.git/'
(Yuri Zubov) #10

@sam I tried to ping with this command

sudo docker run --dns --rm -it alpine ping -c 1
PING ( 56 data bytes

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

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

(Bhanu Sharma) #11

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

(Yuri Zubov) #12

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

dig NS tut.by @

; <<>> DiG 9.11.3-1ubuntu1-Ubuntu <<>> NS tut.by @
;; 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 @

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

; EDNS: version: 0, flags:; udp: 4096
;tut.by.				IN	NS

tut.by.			60	IN	NS	ns1.hosterby.com.
tut.by.			60	IN	NS	ns2.hosterby.com.

;; Query time: 48 msec
;; WHEN: Mon Apr 30 09:04:58 UTC 2018
;; MSG SIZE  rcvd: 83