How to take container snapshots in docker

前端 未结 2 541
情深已故
情深已故 2021-01-30 08:23

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 a

2条回答
  •  感动是毒
    2021-01-30 09:01

    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.

提交回复
热议问题