What’s the difference between Export and Save

Asked

Viewed 55 times

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

  • 1

    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.

  • The export does not represent the metadata of the container save do this, only I found nothing :/

  • 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.

  • 2

    If I can comment on good practices, the ideal is to write a Dockerfile to generate your new images, rather than export/save :)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.