Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to take container snapshots in docker

How do we take container snapshots and load the snapshot in another docker host . I like to know the container snapshoting and not for image. I get confused with export/import and save/load commands in docker. I like to get more clarity or doc to understand them more deeply .

The snapshot to have the metadata to run the container and the roofs . The exact state to be there in the other docker host. Help in this direction would be great.

like image 323
tanmally Avatar asked Mar 13 '14 12:03

tanmally


People also ask

What is a snapshot in Docker?

A docker that allows you to create snapshots (copies) of the current document, and to return to these states afterwards. The main part of the docker is a list of all saved snapshots.

How do I backup a Docker container?

To backup docker images, use the docker save command that will produce a tar archive that can be used later on to create a new docker image with the docker load command.


1 Answers

The command docker commit takes a snapshot of your container. That snapshot is an image, which you can put on a (private) repository to be able to pull it on another host.

An option that does not use an image (which you say you want to avoid) is indeed save and load. According to the documentation this saves your container with all file layers. So if you have a setup with child containers such as Ubuntu > JavaJDK > Elasticsearch > my-container, all 4 file layers would get in there. But you may have the first 3 layers already present as images on the other host, in which case save amounts to a lot of overhead. Then, you can use export and import, which according to the documentation only exports the top file layer (in other words, the container, and not the images below it).

More information on the images, container, file layers etc can be found in the official documentation (e.g. file system.

like image 68
qkrijger Avatar answered Sep 24 '22 23:09

qkrijger