Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

nginx: [emerg] host not found in resolver "run" in /etc/nginx/nginx.conf #36

Closed
pqant opened this issue Nov 13, 2017 · 6 comments
Closed

Comments

@pqant
Copy link

pqant commented Nov 13, 2017

Hi , We're facing an error (nginx: [emerg] host not found in resolver "run" in /etc/nginx/nginx.conf) even simple form of container run command.

the command that we run is "docker run -d -p 80:80 --name nginx blacklabelops/nginx"

any suggestion ?

Thanks

@pqant
Copy link
Author

pqant commented Nov 13, 2017

btw ,

I've just pulled another nginx container ( official and latest one) to understand whether this problem is related with my host computer or not..
as I guess before , it works well without any config.

docker pull nginx
docker run -p 80:80   --name some-nginx -v /home/eralp/html_temp:/usr/share/nginx/html:ro -d nginx

it might helps.

image

@blacklabelops
Copy link
Collaborator

I cant reproduce this. The command is running fine, no error message:

$ docker run -d \
    -p 80:80 \
    --name nginx \
    blacklabelops/nginx

Also the correct jira/nginx configuration can be found here: https://github.com/blacklabelops/jira

@pqant
Copy link
Author

pqant commented Nov 13, 2017

Thank you, I'll try it asap and let you know.

@blacklabelops
Copy link
Collaborator

Your error is in this line:

My config resolver:

resolver 192.168.65.1  ipv6=off valid=30s;

Yours:

resolver run  ipv6=off valid=30s;

Your environment is lacking the docker dns resolver.

I am using this command to get the resolver:

NAMESERVER=$(cat /etc/resolv.conf | grep "nameserver" | head -1 | awk '{print $2}' | tr '\n' ' ')

@pqant
Copy link
Author

pqant commented Nov 13, 2017

Gotcha!

Thank you for your correction. I'll try it and I totally agree with you. This must be my problem.

@aguSparklane
Copy link

I am using this command to get the resolver:
NAMESERVER=$(cat /etc/resolv.conf | grep "nameserver" | head -1 | awk '{print $2}' | tr '\n' ' ')

almost what I needed, when i upgraded from ubuntu 16.04 to 18.04, my resolve.conf as a new commented line. Instead of head -1, i exclude all the comments : grep -v "#"
# run "systemd-resolve --status" to see details about the actual nameservers.

so I used

NAMESERVER=$(cat /etc/resolv.conf | grep -v "#" | grep "nameserver" | awk '{print $2}' | tr '\n' ' ')

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants