# Internal DNS with Docker CLI

**URL:** <https://forums.suse.com/t/internal-dns-with-docker-cli/3079>\
**Category:** Rancher 1.x\
**Created:** [June 10, 2016, 3:31am UTC](https://forums.suse.com/t/internal-dns-with-docker-cli/3079 "2016-06-10T03:31:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ColtonProvias](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/coltonprovias/32/504_2.png) [@ColtonProvias](https://forums.suse.com/u/ColtonProvias)\
**Post date:** [June 10, 2016, 3:31am UTC](https://forums.suse.com/t/internal-dns-with-docker-cli/3079/1 "2016-06-10T03:31:24Z")

</div>

I’m having to launch docker containers via docker’s API to handle backups and I want to be able to reference services via the internal DNS service. For example, I have a mail stack and a service called db. If I run the following docker run command on one of my hosts, I fail to contact the service:

docker run --rm -it -l io.rancher.container.network=“true” --dns 169.254.169.250 --dns-search rancher.internal alpine:edge ping -c 3 db.mail

Is there something I’m missing to get the container to use the internal DNS service? I want to use the docker API so the containers clean themselves up when completed since I did not see an equivalent in the Rancher API.

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [August 3, 2016, 9:31pm UTC](https://forums.suse.com/t/internal-dns-with-docker-cli/3079/2 "2016-08-03T21:31:35Z")

</div>

It fails to connect because it takes awhile to set up the internal DNS service.

For example, if you try this:

```auto
sudo docker run -d -it -l io.rancher.container.network="true" nginx

```

If you go into the standalone container, you will be able to ping `db.mail`
