I'm trying to learn the ins and outs of Docker, and I'm confused by the prospect of saving an image.
I ran the basic Ubuntu image, installed Anaconda Python and a few other things...so now what's the best way to save my progress? Save, commit, export?
None of these seem to work the same way as VirtualBox, which presents an obvious save-state file for your virtual machine.
The usual way is at least through a
docker commit
: that will freeze the state of your container into a new image.Note: As commented by anchovylegend, this is not the best practice, and using a Dockerfile allows you to formally modeling the image content and ensure you can rebuild/reproduce its initial state.
You can then list that image locally with
docker images
, and run it again.Example:
After that, if you have deployed a registry server, you can push your image to said server.
Use a Docker file for these kind of scenarios.
An example case for an Ubuntu image with MongoDB:
Also see Best practices for writing Dockerfiles.