title: DNS resolution with the container
body: <p>I have a docker image which is build from the following file.</p>
  
  <pre><code>FROM java:7
  MAINTAINER Tushar Gandhi
  
  ARG version
  ENV version=$version
  ARG port
  ENV port=$port
  
  RUN mkdir -p /cacheDir/services/live/prediction/p$port/$version/logs
  RUN ls -tlr /cacheDir/services/live/prediction/p$port/
  
  RUN mkdir -p /cacheDir/services/releases/prediction/p$port/$version/
  
  RUN mkdir -p /cacheDir/services/predictionmodel
  ADD target/predictionDependencies/* /cacheDir/services/predictionmodel/
  
  ADD /target/prediction-0.0.13-SNAPSHOT.jar /cacheDir/services/releases/prediction/p$port/$version/prediction-0.0.13-SNAPSHOT.jar
  
  ADD /target/instance.properties /cacheDir/services/releases/prediction/p$port/$version/instance.properties
  
  ADD /target/logback.xml /cacheDir/services/releases/prediction/p$port/$version/logback.xml
  
  RUN ls -ltr /cacheDir/services/live/prediction/p$port/$version/
  RUN ls -ltr /cacheDir/services/releases/prediction/p$port/$version/
  RUN ls -ltr /cacheDir/services/predictionmodel
  
  ENTRYPOINT ["sh","-c","java -server -Xmx2g -Xloggc:/cacheDir/services/live/prediction/p${port}/${version}/logs/gc.log -verbose:gc -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/cacheDir/services/live/prediction/p${port}/${version}/oom.dump -Dlogback.configurationFile=/cacheDir/services/releases/prediction/p${port}/${version}/logback.xml -Dlog.home=/cacheDir/services/live/prediction/p${port}/${version}/logs -Dlogback.debug=true -Dbroker.l^Ct=sv-kafka6.pv.sv.nextag.com:9092,sv-kafka7.pv.sv.nextag.com:9092,sv-kafka8.pv.sv.nextag.com:9092,sv-kafka9.pv.sv.nextag.com:9092 -jar /cacheDir/services/releases/prediction/p${port}/${version}/prediction-0.0.13-SNAPSHOT.jar $port /cacheDir/services/releases/prediction/p${port}/${version}/instance.properties /com/abc/services/$ZK_PATH"]
  </code></pre>
  
  <p>I'm using the following build command to build the image.</p>
  
  <pre><code>docker build --build-arg version=test1 --build-arg port=3001 -f Dockerfile -t prediction:test1 .
  </code></pre>
  
  <p>The image creation is successful and the container comes up to be successful. Run command used</p>
  
  <pre><code>sudo docker run -p 7105:3001 -v ~/PredictionVolume/logs/:/cacheDir/services/live/prediction/p5030/Testing1/logs/ -e ZK_PATH=qa -t prediction:test
  </code></pre>
  
  <p>Now, the problem lies in that my application when runs in a docker container, it tries to access URL qa-zk1.com:2181. This URL is accessible from my system but not from the docker container. Can anyone please suggest a way to make the URL accessible from the container.</p>
  
  <p>[Edit] I have been trying different methods and came across that I was able to ping google.com. This showed me that internet is working. If internet is working, then that URL should also be accessible, but it isn't, therefore it seems to be a problem of DNS resolution. I tried with the IP address and was able to hit the service properly, now I need to find out how to enable that search pattern using a URL rather than an IP address.</p>