Swarm-agent reports no such host failure after start

The issue appears when I’m setting up a swarm environment with the catalog hanging in state of launching services (1/2).
Then the following error was found after I checked docker logs of swarm-agent, one of the 2 services to be brought up:

time="2016-09-08T06:37:23Z" level=info msg="Listening for health checks on 0.0.0.0:10240/healthcheck" time="2016-09-08T06:37:23Z" level=error msg="Rancher stream listener exited with error: Get http://docker-rancher:8080/v1: dial tcp: lookup docker-rancher on 169.254.169.250:53: no such host" time="2016-09-08T06:37:23Z" level=info msg=Exiting.

The segment repeats itself every 30 seconds and thus the service kept stuck in “activating”. It seems that swarm-agent is trying to connect to rancher but name resolution keeps failing.
As I put rancher on the same host of rancheros I think it should just connect to 0.0.0.0:8080. How should I adjust related configs to make it work?

Resolved by replacing the hostname of rancher server with its FQDN.
Seems rancher agent DNS cannot resolve host without DN by itself, although domain name config does exist in /etc/resolv.conf when I was checking agent container.