Docker volume: backup
<p>I have created a volume container. And a container which mounts to en from the volume container.</p>

<p>Volume container:</p>

<pre><code>docker run -d --name nexus-data nexus:1.0 echo "data-only container for Nexus"
</code></pre>

<p>My Nexus container:</p>

<pre><code>docker run -d -p 8443:8443 -p 8081:8081  --name nexus --restart=always --volumes-from nexus-data nexus:1.0
</code></pre>

<p>So this is working fine. I'm able to delete and recreate my nexus-container without losing data. The volume container (which isn't in running state) is saving the data.</p>

<p>But the bottleneck of this approach is the volume-container. When I accidentally delete this container, all the data is gone.
This can happen pretty fast because some useful commands which will delete stopped containers will also delete the volume containers.</p>

<p>So I want to create backups for my volume-containers. 
I tried to ways:</p>

<pre><code>$ docker cp nexus:/this/folder/ /home/ubuntu/backup-folder
</code></pre>

<p>And</p>

<pre><code>$ docker import nexus &gt; /home/ubuntu/backup.tar
</code></pre>

<p>So I have one folder and one .tar in my home directory.
Now I want to know what's the right approach to import one of these backups?</p>

<p><em>I read about the <code>docker export</code> command to create a 'new image' but I don't like this approach because my backup folder is pretty big.</em></p>