0
I’m trying to make a clone or snapshot of a container Docker and all its contents.
More specifically, I have two containers where databases run, one with Cassandra
and another with MySQL
. They are used in tests, so I would like to get a Snapshot of this and copy in another container to be able to use without "spoiling" the original, but I did not succeed in doing so.
Searching for backups/clone/snapshots of containers, I reached the commands Docker commit and Docker save that saves the image and then can be loaded in another container, but I did not succeed with both.
What happens is that I can copy and even settings, but not the data of the instances of the banks, it comes empty.
I could generate scripts to do this, and every time I need to create a new container and run the scripts, but I believe that a clone/snapshot would be simpler and seems to me something trivial, only I don’t know how to do :(
So my question is: how to take a backup or snapshot of a Docker container and create a new one, keeping the data, especially the data of a container with a database, its tables and data?
How do you want to backup the container data
docker cp
wouldn’t solve this? Ideally you would use volumes, hence would keep your data persistence...– Tuxpilgrim
but using the
docker cp
i need to inform the folders/files I want to copy right? I would like something simpler as if it weredocker cp cointainer-origem to container-destino
– Ricardo Pontual
I get it, via Docker I don’t know a Feature that does that :/
– Tuxpilgrim
creates a checkpoint https://docs.docker.com/engine/reference/commandline/checkpoint/
– Adir Kuhn
@Adirkuhn read the link from the command, and this is an experimental command right? but the question is: create the checkpoint, and then restore on another machine?
– Ricardo Pontual