How to stop/relaunch docker container without losing the changes? : <p>I did the following and lost all the changed data in my Docker container.</p>

<ol>
<li><code>docker build -t &lt;name:tag&gt; .</code></li>
<li><code>docker run *-p 8080:80* --name &lt;container_name&gt; &lt;name:tag&gt;</code></li>
<li><code>docker exec</code> (import and process some files, launch a server to host them)</li>
</ol>

<p>Then I wanted to run it on a different port. <code>docker stop</code> &amp; <code>docker run</code> does not work. Instead I did</p>

<ol start="4">
<li><code>docker stop</code></li>
<li><code>docker rm &lt;container_name&gt;</code></li>
<li><code>docker run</code> (same parameters as before)</li>
</ol>

<p>After the restart I saw the changes that happened in the container at 1-3 had disappeared, and had to re-run the import.</p>

<p>How do I do this correctly next time?</p>
