title: How can I get Docker Linux container information from within the container itself?
body: <p>I would like to make my <code>docker containers</code> aware of their configuration, the same way you can get information about EC2 instances through metadata.</p>
  
  <p>I can use (provided <code>docker</code> is listening on port <code>4243</code>)</p>
  
  <pre><code>curl http://172.17.42.1:4243/containers/$HOSTNAME/json
  </code></pre>
  
  <p>to get some of its data, but would like to know if there is a better way at least the get the full ID of the container, because <code>HOSTNAME</code> is actually shortened to 12 characters and docker seems to perform a "best match" on it.</p>
  
  <p>Also, how can I get the external IP of the docker host (other than accessing the EC2 metadata, which is specific to AWS)</p>