I have created a volume container. And a container which mounts to en from the volume container.
Volume container:
docker run -d --name nexus-data nexus:1.0 echo "data-only container for Nexus"
My Nexus container:
docker run -d -p 8443:8443 -p 8081:8081 --name nexus --restart=always --volumes-from nexus-data nexus:1.0
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.
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.
So I want to create backups for my volume-containers. I tried to ways:
$ docker cp nexus:/this/folder/ /home/ubuntu/backup-folder
And
$ docker import nexus > /home/ubuntu/backup.tar
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?
I read about the docker export
command to create a 'new image' but I don't like this approach because my backup folder is pretty big.