Reputation: 13
I'm working on a Node/Mongo project in Docker and I'm having some trouble starting it in a certain way.
docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
projectName latest 4adabfbf53f9 16 minutes ago 2.99GB
mongo latest a0f922b3f0a1 4 days ago 366MB
node latest aa3e171e4e95 2 weeks ago 673MB
I'd like to be able to save these images to a tar file and load them onto another machine. Once they're loaded, running docker-compose up fails with an error about not being able to find a config file.
Is there a way save/load Docker images like this?
Upvotes: 1
Views: 5678
Reputation: 5847
One of the core principles of docker is that the containers should be the same if you remove and start them again. Data that you wish to persist can be stored in separate docker volumes or even on a mounted volume which resides on your disk.
If you have a Dockerfile, can you not just move that to the other computer and build it there, or even use a docker registry like docker hub to store the pre-built image? That's the standard way of doing it.
With that said, it is possible to make changes to a container then commit them to the image so that the image itself is updated. Or you can dump the container directly to a tarball with the export command, but I'm not sure this is actually what you need.
Upvotes: 1