Rename a project by keeping containers
<p>I decided to change the project name of a docker composition:</p>

<pre class="lang-sh prettyprint-override"><code>$ docker-compose -p old_name up -d # Before
Starting old_name_web_1
$ docker-compose -p new_name up -d # After
Creating new_name_web_1
</code></pre>

<p>But I don't wanted to delete my containers, so I renamed them:</p>

<pre class="lang-sh prettyprint-override"><code>$ docker rename old_name_web_1 new_name_web_1
...
</code></pre>

<p>I thought docker-compose was based on container names, but it does not seem to be the case:</p>

<pre class="lang-sh prettyprint-override"><code>$ docker-compose -p new_name up -d
</code></pre>

<blockquote>
  <p>ERROR: for web  Cannot create container for service web: Conflict. The name "/new_name_web_1" is already in use by container 4930deaabb[...]. You have to remove (or rename) that container to be able to reuse that name.
  ERROR: Encountered errors while bringing up the project.</p>
</blockquote>

<p>How can I relink my old containers to the new composition ?</p>