title: docker-compose use extra_hosts with container id
body: <p>I have a dockerized app that needs to talk to an external (not dockerized) oracle database.</p>
  
  <p>The app works on my local machine only if I append the result of the <code>hostname</code> command to the <code>localhost</code> entry in my <code>/etc/hosts</code> file. Otherwise I get an error from the OracleDB driver:</p>
  
  <blockquote>
    <p>Caused by: oracle.net.ns.NetException: Listener refused the connection
    with the following error: ORA-12514, TNS:listener does not currently
    know of service requested in connect descriptor</p>
  </blockquote>
  
  <p>I could log in my container and edit <code>/etc/hosts</code> manually, I would like to avoid this manual step after rebuilding. How do I keep this file up to date?</p>
  
  <p>Furthermore it seems the <code>hostname</code> set by docker is the container id.</p>
  
  <p>Is there a way to reference a container id from inside the <code>docker-compose.yml</code> file?</p>