link containers with the docker python API
<p>I want to use the docker python API (<code>pip install docker-py</code>) to create a container and link it to an existing container which I created with docker-compose.</p>

<p>Using the command line this is easy:</p>

<p><code>docker run --link EXISTING_CONTAINER:LINK_NAME mycontainer:mytag
</code></p>

<p>But using the docker API I'm stuck. I think that I have to use the <code>docker.Client().create_container()</code> method, which takes an - undocumented - parameter <code>links=</code>. (I strongly think the documentation is pretty much incomplete ...). </p>

<p>I tried reading the docker-compose code, and this seems to use the <code>links=</code> parameter, but I could not figure out how.</p>

<p>My initial attempt did not work:</p>

<p><code>client_obj.create_container(..., links=(('EXISTING_CONTAINER', 'LINK_NAME'),))
</code></p>

<p>... which is what I think the docker-compose code is doing.</p>

<p>Can someone help me out here?</p>