title: Dynamically add docker container ip in Dockerfile ( redis)
body: <p>How do I dynamically add container ip in other Dockerfile ( I am running two container a) Redis b) java application . 
  I need to pass redis url on run time to my java arguments </p>
  
  <p>Currently I am manually checking the redis ip and copying it in Dockerfile. and later creating new image using redis ip for java application. </p>
  
  <pre><code>docker run --name my-redis -d redis
  docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' my-redis 
  </code></pre>
  
  <p>IN Dockerfile (java application)</p>
  
  <pre><code>CMD ["-Dspring.redis.host=172.17.0.2", "-jar", "/apps/some-0.0.1-SNAPSHOT.jar"]
  </code></pre>
  
  <p>Can I use any script to update the DockerFile or can use any environment variable.</p>