Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker commit doesn't save changes

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.

like image 796
user4629556 Avatar asked Mar 03 '15 21:03

user4629556


People also ask

How do I save changes in docker container?

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.

What docker commit does?

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.

Do docker containers save?

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.


1 Answers

"docker commit" cannot save mount volumes' data ~ You should docker cp files to the container ~

like image 155
亚里士朱德 Avatar answered Oct 25 '22 06:10

亚里士朱德