title: How to link binaries between docker containers
body: <p>Is it possible to use docker to expose the binary from one container to another container? </p>
  
  <p>For example, I have 2 containers: </p>
  
  <ul>
  <li>centos6  </li>
  <li>sles11  </li>
  </ul>
  
  <p>I need both of these containers to have similar versions git installed. Unfortunately the sles container does not have the version of git that I need. </p>
  
  <p>I want to spin up a git container like so:</p>
  
  <pre><code>$ cat Dockerfile
  FROM ubuntu:14.04
  MAINTAINER spuder
  
  RUN apt-get update
  RUN apt-get install -yq git
  CMD /usr/bin/git
  # ENTRYPOINT ['/usr/bin/git'] 
  </code></pre>
  
  <p>Then link the centos6 and sles11 containers to the git container so that they both have access to a git binary, without going through the trouble of installing it. </p>
  
  <p>I'm running into the following problems: </p>
  
  <ul>
  <li>You can't link a container to another non running container</li>
  <li>I'm not sure if this is how docker containers are supposed to be used. </li>
  </ul>
  
  <p>Looking at the <a href="https://docs.docker.com/userguide/dockerlinks/" rel="noreferrer">docker documentation, it appears that linked containers</a> have shared environment variables and ports, but not necessarily access to each others entrypoints. </p>
  
  <p>How could I link the <code>git</code> container so that the cent and sles containers can access this command? Is this possible? </p>