Yeah, you're right, they are many topics like that. I didn't find a solution for my problem. So give me a chance!
I run a docker container with no defined volumes. So what I want is to commit changes like:
docker commit 3a09b2588478 myfantasticimage
docker save myfantasticimage > /tmp/fantasticimagecommit.tar
Now I transfer the image via scp to another docker-host an do
docker load < /tmp/fantasticimagecommit.tar
Starting image and I can't see change I do before commited it. What's the problem. According to the Dockerfile, no volumes are defined.
Thanks!
Update: I've found volumes via docker inspect
-command
"VolumesRW": {
"/var/lib/": true,
"/var/log/": true,
"/var/www/": true
}
What could be a workaround? I want do back up every 6 hours a container, so I can restore it on the same or another machine without expended effort.
If you want to make changes inside the container and want those changes to persist, you can use the Docker commit command. This will create a new image with all the changes made to the previous container committed to it.
It can be useful to commit a container's file changes or settings into a new image. This allows you to debug a container by running an interactive shell, or to export a working dataset to another server. Generally, it is better to use Dockerfiles to manage your images in a documented and maintainable way.
Docker also supports containers storing files in-memory on the host machine. Such files are not persisted. If you're running Docker on Linux, tmpfs mount is used to store files in the host's system memory. If you're running Docker on Windows, named pipe is used to store files in the host's system memory.
"docker commit" cannot save mount volumes' data ~
You should docker cp
files to the container ~
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With