{"id":42192,"date":"2016-12-02T15:00:57","date_gmt":"2016-12-02T13:00:57","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=42192"},"modified":"2019-03-29T14:13:00","modified_gmt":"2019-03-29T12:13:00","slug":"configuring-dns-docker","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/","title":{"rendered":"Configuring DNS in Docker"},"content":{"rendered":"<h2>1. Introduction<\/h2>\n<p>This post introduces Docker Engine&#8217;s network feature in general and specifically introduces configuring DNS in containers. This post assumes that you have the Docker Engine installed and that you know the <a href=\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-hello-world-example\/\">basics<\/a> of working with <a href=\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/docker-container-use-docker\/\">containers<\/a>.<\/p>\n<p>We will not discuss service discovery from other networks here since that needs a deeper knowledge of Docker tools like Docker Swarm. Since these posts focus on the basics of Docker we will focus on networking cotainers within the same host. So let&#8217;s get started with understanding the basics of networking in Docker.\n<\/p>\n<h2>2. Basics of Networking Configurations in Docker Engine<\/h2>\n<p>The Docker Engine provides 3 networks by default &#8211; <code>bridge<\/code>, <code>host<\/code> and <code>none<\/code>. The command <code>docker network ls<\/code> lists out all networks created by Docker. So on a default installation you will see something like this.<\/p>\n<pre class=\"brush:bash\">$ docker network ls\nNETWORK ID          NAME                DRIVER              SCOPE\n36d51e62e518        bridge              bridge              local               \n18e8e68644ea        host                host                local               \n1f87f168df62        none                null                local\n<\/pre>\n<p>The <code>bridge<\/code> network is mapped to the <code>docker0<\/code> network bridge on the Docker Engine&#8217;s host. The <code>ip address<\/code> command can be used to check the details of docker0.<\/p>\n<pre class=\"brush:bash\">$ ip address show label docker0\n7: docker0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc noqueue state UP \n    link\/ether 02:45:01:c0:ba:c7 brd ff:ff:ff:ff:ff:ff\n    inet 172.17.0.1\/16 scope global docker0\n       valid_lft forever preferred_lft forever\n    inet6 fe80::42:1ff:fec0:bac7\/64 scope link \n       valid_lft forever preferred_lft forever\n<\/pre>\n<h3>2.1. Inspect Networks<\/h3>\n<p>Every container created by the Docker engine is added to the default <code>bridge<\/code> network. The command <code>docker network inspect<\/code> can be used to inspect the network like so&#8230;<\/p>\n<pre class=\"brush:bash\">$ docker network inspect bridge\n[\n    {\n        \"Name\": \"bridge\",\n        \"Id\": \"36d51e62e518d5430c798ce6eb68dc2737e9ad0555dd45097b04ef7597bce644\",\n        \"Scope\": \"local\",\n        \"Driver\": \"bridge\",\n        \"EnableIPv6\": false,\n        \"IPAM\": {\n            \"Driver\": \"default\",\n            \"Options\": null,\n            \"Config\": [\n                {\n                    \"Subnet\": \"172.17.0.0\/16\",\n                    \"Gateway\": \"172.17.0.1\"\n                }\n            ]\n        },\n        \"Internal\": false,\n        \"Containers\": {},\n        \"Options\": {\n            \"com.docker.network.bridge.default_bridge\": \"true\",\n            \"com.docker.network.bridge.enable_icc\": \"true\",\n            \"com.docker.network.bridge.enable_ip_masquerade\": \"true\",\n            \"com.docker.network.bridge.host_binding_ipv4\": \"0.0.0.0\",\n            \"com.docker.network.bridge.name\": \"docker0\",\n            \"com.docker.network.driver.mtu\": \"1500\"\n        },\n        \"Labels\": {}\n    }\n]\n<\/pre>\n<p>Note the <code>\"Containers\"<\/code> section in the above picture. It lists the containers attached to the <code>bridge<\/code> network. This section will be empty in a fresh Docker installation or when all containers are stopped.<\/p>\n<h3>2.2. Create User Defined Networks<\/h3>\n<p>Apart from the default networks, users can create new networks with the <code>docker network create<\/code> command. Let us create a new network called example-network and inspect it&#8217;s contents now.<\/p>\n<pre class=\"brush:bash\">$ docker network create example-network &amp;&amp; docker network inspect example-network\n301ffd3fbc1e323d40d2bc687f2e5c6341c16011e91d57151577fa08c914a157\n[\n    {\n        \"Name\": \"example-network\",\n        \"Id\": \"301ffd3fbc1e323d40d2bc687f2e5c6341c16011e91d57151577fa08c914a157\",\n        \"Scope\": \"local\",\n        \"Driver\": \"bridge\",\n        \"EnableIPv6\": false,\n        \"IPAM\": {\n            \"Driver\": \"default\",\n            \"Options\": {},\n            \"Config\": [\n                {\n                    \"Subnet\": \"172.18.0.0\/16\",\n                    \"Gateway\": \"172.18.0.1\/16\"\n                }\n            ]\n        },\n        \"Internal\": false,\n        \"Containers\": {},\n        \"Options\": {},\n        \"Labels\": {}\n    }\n]\n<\/pre>\n<p>Let us now add a container to this network and inspect again. The command <code>docker run --network=<\/code> can be used to attach a container to a network of our choice, like below:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:bash\">$ docker run -itd --name=infinite_loop --network=example-network enhariharan\/infinite-loop\n8da6157240e09d69c7490c1af4ce483b30ff6f7ba7804b45818c0975e7b8ba25\n<\/pre>\n<p>The container is added into the network <code>example-network<\/code>. Let us now investigate the network settings again.<\/p>\n<pre class=\"brush:bash\">$ docker network inspect example-network\n[\n    {\n        \"Name\": \"example-network\",\n        \"Id\": \"301ffd3fbc1e323d40d2bc687f2e5c6341c16011e91d57151577fa08c914a157\",\n        \"Scope\": \"local\",\n        \"Driver\": \"bridge\",\n        \"EnableIPv6\": false,\n        \"IPAM\": {\n            \"Driver\": \"default\",\n            \"Options\": {},\n            \"Config\": [\n                {\n                    \"Subnet\": \"172.18.0.0\/16\",\n                    \"Gateway\": \"172.18.0.1\/16\"\n                }\n            ]\n        },\n        \"Internal\": false,\n        \"Containers\": {\n            \"8da6157240e09d69c7490c1af4ce483b30ff6f7ba7804b45818c0975e7b8ba25\": {\n                \"Name\": \"infinite_loop\",\n                \"EndpointID\": \"ccb0318b24dc3b0f1676f5aa16e5ea839adb715baa6bcd4ad16cdadb4aabd973\",\n                \"MacAddress\": \"02:42:ac:12:00:02\",\n                \"IPv4Address\": \"172.18.0.2\/16\",\n                \"IPv6Address\": \"\"\n            }\n        },\n        \"Options\": {},\n        \"Labels\": {}\n    }\n]\n<\/pre>\n<p>You can see that the <code>\"Containers\"<\/code> section now has the container <code>infinite_loop<\/code> created from the image.<\/p>\n<h3>2.3. Connect Containers Within a Network<\/h3>\n<p>All containers are added to the <code>bridge<\/code> network by default. Containers within the same Docker network can connect to each other. Let us see that through a simple example. We will create 2 simple containers from the image <code>enhariharan\/infinite-loop<\/code> into the custom network <code>example-network<\/code> created earlier. Then we&#8217;ll inspect the network to see that the containers were added as expected.<\/p>\n<pre class=\"brush:bash\">$ docker run -itd --name=infinite_loop_1 --network=example-network enhariharan\/infinite-loop\n3c23fb845274e24ac8bdaa3216affc3b6d2755b58e6a8a4424c4008ca3c8022c\n$\n$ docker run -itd --name=infinite_loop_2 --network=example-network enhariharan\/infinite-loop\n9bd946658d4456618f60413e0cb41f6b4502eb60cfbff325a1bd7f218bffdd45\n$\n$ docker network inspect example-network\n...\n       \"Containers\": {\n            \"3c23fb845274e24ac8bdaa3216affc3b6d2755b58e6a8a4424c4008ca3c8022c\": {\n                \"Name\": \"infinite_loop_1\",\n                \"EndpointID\": \"0c5fc22252e5d88ae746fb07d9dc9827ab6840a40db956eff2ed8bcfa042a099\",\n                \"MacAddress\": \"02:42:ac:12:00:02\",\n                \"IPv4Address\": \"172.18.0.2\/16\",\n                \"IPv6Address\": \"\"\n            },\n            \"9bd946658d4456618f60413e0cb41f6b4502eb60cfbff325a1bd7f218bffdd45\": {\n                \"Name\": \"infinite_loop_2\",\n                \"EndpointID\": \"1eecb3c8414026bfeaf63cfb23fb5319ca068c2c3c220ad486f19de02b2225bd\",\n                \"MacAddress\": \"02:42:ac:12:00:03\",\n                \"IPv4Address\": \"172.18.0.3\/16\",\n                \"IPv6Address\": \"\"\n            }\n        },\n...\n<\/pre>\n<p>Containers <code>infinite_loop_1<\/code> and <code>infinite_loop_2<\/code> were created in detached mode. They have been added into <code>example-network<\/code> with IP address <code>172.18.0.2<\/code> and <code>172.18.0.3<\/code> respectively, as confirmed above. If the <code>--network=<\/code> is not provided then containers are added to the <code>bridge<\/code> network by default. Now, let us open a session into the container <code>infinite_loop_1<\/code> and try to ping <code>infinite_loop_2<\/code>.<\/p>\n<pre class=\"brush:bash\">$ docker exec -it infinite_loop_1 sh\n\/ # ping -c 5 172.18.0.3\nPING 172.18.0.3 (172.18.0.3): 56 data bytes\n64 bytes from 172.18.0.3: seq=0 ttl=64 time=0.165 ms\n64 bytes from 172.18.0.3: seq=1 ttl=64 time=0.124 ms\n64 bytes from 172.18.0.3: seq=2 ttl=64 time=0.115 ms\n64 bytes from 172.18.0.3: seq=3 ttl=64 time=0.115 ms\n64 bytes from 172.18.0.3: seq=4 ttl=64 time=0.116 ms\n\n--- 172.18.0.3 ping statistics ---\n5 packets transmitted, 5 packets received, 0% packet loss\nround-trip min\/avg\/max = 0.106\/0.117\/0.137 ms\n<\/pre>\n<p>So as you can see, containers added into the same network can automatically find each other through their IP addresses. Next, let us see how to setup DNS in Docker so that we need use the IP addresses to communicate.<\/p>\n<h2>3. Setup Container DNS in Bridge Network<\/h2>\n<p>Docker engine uses these 3 files within every container to configure it&#8217;s DNS.<\/p>\n<ul>\n<li><code>\/etc\/hostname<\/code> &#8211; This file maps the container IP address to a name.<\/li>\n<li><code>\/etc\/hosts<\/code> &#8211; This file maps other container&#8217;s IP addresses to names.<\/li>\n<li><code>\/etc\/resolv.conf<\/code> &#8211; This file contains the IP addresses of other DNS servers to refer to if the container cannot resolve a name to IP address.<\/li>\n<\/ul>\n<p>These files can be setup and manipulated using the <code>docker run<\/code> command. The hostname for a container is set into <code>\/etc\/hostname<\/code> using the <code>--hostname=<\/code> option.[ulp id=&#8217;6PVIvOz3kDbYmNRn&#8217;]<\/p>\n<pre class=\"brush:bash\">$ docker run -itd --name=infinite_loop_1 --hostname=container1 enhariharan\/infinite-loop\n986d6b95a283493edd6d331d3c9f0c31595b9ec2b4ffae737ad99f5b1b090c46\n$\n$ docker exec -it infinite_loop_1 cat \/etc\/hostname\ncontainer1\n<\/pre>\n<p>The entry of <code>container1<\/code> can be put into the <code>\/etc\/hosts<\/code> file of <code>container2<\/code> using the <code>--link=<\/code> option of <code>docker run<\/code>. Let us try one more example now, we will link <code>infinite_loop_1<\/code> to <code>infinite_loop_2<\/code> and ping <code>container1<\/code> from within <code>container2<\/code> using the hostname of <code>infinite_loop_1<\/code>.<\/p>\n<pre class=\"brush:bash\">$ docker run -itd --name=infinite_loop_1 --hostname=container1 enhariharan\/infinite-loop\nc97fe6577f1e8b2ca90b04157a299c45becadea5a5ccd61564c8d279d98c3719\n$\n$ docker run -itd --name=infinite_loop_2 --hostname=container2 --link=infinite_loop_1 enhariharan\/infinite-loop\n2a26adfae9fb06038a823e4fea9a5118875abbdb8e023502eda96c91d4c79d6c\n$\n$ docker exec -it infinite_loop_2 cat \/etc\/hosts\n127.0.0.1\tlocalhost\n::1\tlocalhost ip6-localhost ip6-loopback\nfe00::0\tip6-localnet\nff00::0\tip6-mcastprefix\nff02::1\tip6-allnodes\nff02::2\tip6-allrouters\n172.17.0.3\tinfinite_loop_1 container1\n172.17.0.4\tcontainer2\n$\n$ docker exec -it infinite_loop_2 ping -c 5 container1\nPING container1 (172.17.0.3): 56 data bytes\n64 bytes from 172.17.0.3: seq=0 ttl=64 time=0.175 ms\n64 bytes from 172.17.0.3: seq=1 ttl=64 time=0.118 ms\n64 bytes from 172.17.0.3: seq=2 ttl=64 time=0.115 ms\n64 bytes from 172.17.0.3: seq=3 ttl=64 time=0.123 ms\n64 bytes from 172.17.0.3: seq=4 ttl=64 time=0.118 ms\n\n--- container1 ping statistics ---\n5 packets transmitted, 5 packets received, 0% packet loss\nround-trip min\/avg\/max = 0.115\/0.129\/0.175 ms\n<\/pre>\n<p>But the fun with discovering containers in the <code>bridge<\/code> network sort of stops here. To connect to containers without using their IP addreses and without linking to them at <code>docker run<\/code> as above we need to do user-defined networks of Docker. Let us see the basics of that next.<\/p>\n<h2>4. Setup Container DNS in a User Defined Network<\/h2>\n<p>There are some important differences between connecting containers in user-defined networks and within <code>bridge<\/code> network. One such point is that the <code>--link<\/code> option of <code>docker run<\/code> will not work in user-defined networks. Let us see how we can get the same functionality as above using user-defined networks. We will add the containers <code>infinite_loop_1<\/code> and <code>infinite_loop_2<\/code> into a user-defined network called <code>example_network<\/code> and ping <code>infinite_loop_2<\/code> from within <code>infinite_loop_1<\/code>.<\/p>\n<pre class=\"brush:bash\">$ docker run -itd --name=infinite_loop_1 --hostname=container1 --network=example_network enhariharan\/infinite-loop\nd91757ae6e4dab01d9a37e73ec9a314c15ed195e5763fb6d9898ceb45dbc0964\n$\n$ docker run -itd --name=infinite_loop_2 --hostname=container2 --network=example_network enhariharan\/infinite-loop\n3ab4dad71bad7114025db7330686cb23114c76f705f9e3489a2763aa74970f2b\n$\n$ docker exec -it infinite_loop_2 ping -c 4 infinite_loop_1\nPING infinite_loop_1 (172.20.0.2): 56 data bytes\n64 bytes from 172.20.0.2: seq=0 ttl=64 time=0.111 ms\n64 bytes from 172.20.0.2: seq=1 ttl=64 time=0.122 ms\n64 bytes from 172.20.0.2: seq=2 ttl=64 time=0.119 ms\n64 bytes from 172.20.0.2: seq=3 ttl=64 time=0.131 ms\n\n--- infinite_loop_1 ping statistics ---\n4 packets transmitted, 4 packets received, 0% packet loss\nround-trip min\/avg\/max = 0.111\/0.120\/0.131 ms\n$\n$ docker exec -it infinite_loop_2 ping -c 4 container1\nping: bad address 'container1'\n<\/pre>\n<p>From the above snippet, it is seen that containers are visible in the same network by their container names but not their host names since ping by the hostname <code>container1<\/code> does not work.<\/p>\n<p>The recommended way is to add a network-alias to each container apart from the hostname. This network-alias can then be used to connect by other containers. Let us try the above steps again but by setting a network-alias this time.<\/p>\n<pre class=\"brush:bash\">$ docker run -itd --name=infinite_loop_1 --hostname=container1 --network=example_network --network-alias=container1_alias enhariharan\/infinite-loop\nc80675335e3a235b84e317d5a160324e7add9421d197524a26ef2c461a679f1c\n$\n$ docker run -itd --name=infinite_loop_2 --hostname=container2 --network=example_network --network-alias=container2_alias enhariharan\/infinite-loop\n532b2d3d2694ed41c3abe44ae32671619b312b9a5c33604f8eaacd620b1d2874\n$\n$ docker exec -it infinite_loop_2 ping -c 4 container1_alias\nPING container1_alias (172.20.0.2): 56 data bytes\n64 bytes from 172.20.0.2: seq=0 ttl=64 time=0.127 ms\n64 bytes from 172.20.0.2: seq=1 ttl=64 time=0.115 ms\n64 bytes from 172.20.0.2: seq=2 ttl=64 time=0.119 ms\n64 bytes from 172.20.0.2: seq=3 ttl=64 time=0.113 ms\n\n--- container1_alias ping statistics ---\n4 packets transmitted, 4 packets received, 0% packet loss\nround-trip min\/avg\/max = 0.113\/0.118\/0.127 ms\n<\/pre>\n<p>So this is how Docker Engine&#8217;s embedded DNS can be configured so that containers can communicate with other containers within the same host and within the same network bridge. To talk among other networks or to talk among other hosts an <code>overlay<\/code> network must be configured. Also, a cluster of Docker hosts can be created using tools like <a href=\"https:\/\/docs.docker.com\/swarm\/\">Docker Swarm.<\/a> These topics are outside the scope of this post and will be taken up in a future post.<\/p>\n<h2>5. Summary<\/h2>\n<p>In this post, we were introduced to the basics of Docker networking.&nbsp; We learned the types of networks supported and how to create a user-defined <code>bridge<\/code> type network. We also understand how to add containers into specific networks. Then we understood how containers can communicate with one another by configuring the embedded DNS server provided by Docker Engine.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Introduction This post introduces Docker Engine&#8217;s network feature in general and specifically introduces configuring DNS in containers. This post assumes that you have the Docker Engine installed and that you know the basics of working with containers. We will not discuss service discovery from other networks here since that needs a deeper knowledge of &hellip;<\/p>\n","protected":false},"author":103,"featured_media":31013,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1354],"tags":[1622,1621],"class_list":["post-42192","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker","tag-dns","tag-networking"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Configuring DNS in Docker - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"This post discusses the basics of Docker networks and explains how to configure the DNS in a Docker installation.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Configuring DNS in Docker - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"This post discusses the basics of Docker networks and explains how to configure the DNS in a Docker installation.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2016-12-02T13:00:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-29T12:13:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Hariharan Narayanan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Hariharan Narayanan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/\"},\"author\":{\"name\":\"Hariharan Narayanan\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/780d96edfe3bce18c5440613fa88bce3\"},\"headline\":\"Configuring DNS in Docker\",\"datePublished\":\"2016-12-02T13:00:57+00:00\",\"dateModified\":\"2019-03-29T12:13:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/\"},\"wordCount\":896,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg\",\"keywords\":[\"dns\",\"networking\"],\"articleSection\":[\"Docker\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/\",\"name\":\"Configuring DNS in Docker - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg\",\"datePublished\":\"2016-12-02T13:00:57+00:00\",\"dateModified\":\"2019-03-29T12:13:00+00:00\",\"description\":\"This post discusses the basics of Docker networks and explains how to configure the DNS in a Docker installation.\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DevOps\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/devops\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Docker\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/devops\/docker\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Configuring DNS in Docker\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/780d96edfe3bce18c5440613fa88bce3\",\"name\":\"Hariharan Narayanan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Hariharan-Narayanan-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Hariharan-Narayanan-96x96.jpg\",\"caption\":\"Hariharan Narayanan\"},\"description\":\"Hari graduated from the School of Computer and Information Sciences in the University of Hyderabad. Over his career he has been involved in many complex projects in mobile applications, enterprise applications, distributed applications, micro-services, and other platforms and frameworks. He works as a consultant and is mainly involved with projects based on Java, C++ and Big Data technologies.\",\"sameAs\":[\"https:\/\/www.javacodegeeks.com\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/hariharan-narayanan\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Configuring DNS in Docker - Java Code Geeks","description":"This post discusses the basics of Docker networks and explains how to configure the DNS in a Docker installation.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/","og_locale":"en_US","og_type":"article","og_title":"Configuring DNS in Docker - Java Code Geeks","og_description":"This post discusses the basics of Docker networks and explains how to configure the DNS in a Docker installation.","og_url":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2016-12-02T13:00:57+00:00","article_modified_time":"2019-03-29T12:13:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","type":"image\/jpeg"}],"author":"Hariharan Narayanan","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Hariharan Narayanan","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/"},"author":{"name":"Hariharan Narayanan","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/780d96edfe3bce18c5440613fa88bce3"},"headline":"Configuring DNS in Docker","datePublished":"2016-12-02T13:00:57+00:00","dateModified":"2019-03-29T12:13:00+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/"},"wordCount":896,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","keywords":["dns","networking"],"articleSection":["Docker"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/","url":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/","name":"Configuring DNS in Docker - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","datePublished":"2016-12-02T13:00:57+00:00","dateModified":"2019-03-29T12:13:00+00:00","description":"This post discusses the basics of Docker networks and explains how to configure the DNS in a Docker installation.","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/docker-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/devops\/docker\/configuring-dns-docker\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"DevOps","item":"https:\/\/examples.javacodegeeks.com\/category\/devops\/"},{"@type":"ListItem","position":3,"name":"Docker","item":"https:\/\/examples.javacodegeeks.com\/category\/devops\/docker\/"},{"@type":"ListItem","position":4,"name":"Configuring DNS in Docker"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/780d96edfe3bce18c5440613fa88bce3","name":"Hariharan Narayanan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Hariharan-Narayanan-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Hariharan-Narayanan-96x96.jpg","caption":"Hariharan Narayanan"},"description":"Hari graduated from the School of Computer and Information Sciences in the University of Hyderabad. Over his career he has been involved in many complex projects in mobile applications, enterprise applications, distributed applications, micro-services, and other platforms and frameworks. He works as a consultant and is mainly involved with projects based on Java, C++ and Big Data technologies.","sameAs":["https:\/\/www.javacodegeeks.com"],"url":"https:\/\/examples.javacodegeeks.com\/author\/hariharan-narayanan\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/42192","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/103"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=42192"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/42192\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/31013"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=42192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=42192"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=42192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}