1
I need to save the changes I made to an image in the container, and I wanted to understand the difference:
docker export <CONTAINER ID> > /home/export.tar
docker image save [OPTIONS] IMAGE [IMAGE...] > /home/export.tar
I read that the 2 generates a file with the image, but the save
can place more than one image. However the 2 generates a .tar
with the image.
I would like to know which of the 2 to use, and I need all the changes I made to the container in a new image
Well, just by the commands you put in the question, the first is used with containers and the second with images. That alone should answer a lot.
– Woss
The
export
does not represent the metadata of the containersave
do this, only I found nothing :/– David
It’s like Woss said, the
save
will save the image (including layers, tags),export
saves the container (except the volumes associated with that container).... does not have much to say. To save your container changes in a new image use export, just paying attention to the detail of the volumes.– Tuxpilgrim
If I can comment on good practices, the ideal is to write a Dockerfile to generate your new images, rather than export/save :)
– Tuxpilgrim