user4629556
user4629556

Reputation: 111

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.

Upvotes: 11

Views: 3597

Answers (2)

Rakesh Karkare
Rakesh Karkare

Reputation: 79

For Saving and Loading Docker Images in another machine without going through docker hub

use below commands

Let say you have an app.tar file then for saving it with app and tag number. Use below commands

docker image save -o app.tar app:3

For Loading it use below command

docker image load -i app.tar

Upvotes: 0

亚里士朱德
亚里士朱德

Reputation: 517

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

Upvotes: 2

Related Questions