moby / swarmkit

A toolkit for orchestrating distributed systems at any scale. It includes primitives for node discovery, raft-based consensus, task scheduling and more.
Apache License 2.0
3.36k stars 616 forks source link

the container create from replicas mode service can not resolve domain #1414

Open shenshouer opened 8 years ago

shenshouer commented 8 years ago

If I create replicas mode service, the container created by the tasks can not resolve external domain . And can do in host.

core@worker-10-xx-x-34 ~ $ docker exec -it 0c0d7b939d11 sh
/ # ping mysql-gp-discuz-1-master
ping: bad address 'mysql-gp-discuz-1-master'
/ # exit
core@worker-10-xx-x-34 ~ $ docker version
Client:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:        Thu Aug 18 17:52:38 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:        Thu Aug 18 17:52:38 2016
 OS/Arch:      linux/amd64
shenshouer commented 8 years ago

Can access the domain If I add the suffix to the domain. for example : I cannot access the domain mysql-gp-discuz-1-master in container created by the replicas service in swarm mode.

But can access the domain mysql-gp-discuz-1-master.localhost in the same container

dperny commented 8 years ago

Is this related to #1429 ? (I know you were here first but I've been going down the issues in reverse chronological order)

shenshouer commented 8 years ago

No,I think the DNS in container cannot inherit the DNS from host. I must add the search domain to private domain to access. for example:

I have the domain mysql-gp-discuz-1-master for MySQL database In my private DNS, If connect to this MySQL in container which created by replicas service, I must changed mysql-gp-discuz-1-master to mysql-gp-discuz-1-master.localhost in the container code.