Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker commit is not saving my changes to image

Tags:

docker

commit

I'm new to docker world: I'm at a point where i can deploy docker containers and do some work.

Trying to get to the next level of saving my changes and moving my containers/images to another pc/server.

Currently, I'm using docker on windows 10, but I do have access to Ubuntu 16.04 server to test my work.

This is where I'm stuck: I have Wordpress and MariaDB images deployed on Docker.
My WP is running perfectly OK.I have installed few themes and created few pages with images.

At this point, I like to save my work and send it to my friend who will deploy my image and do further work on this same Wordpress.

What I have read online is: I should run docker commit command to save and create my docker image in .tar format and then send this image file (.tar) to my friend. He will run docker load -i on my file to load it as image into his docker and then create container from it which should give him all of my work on Wordpress.

Just to clarify, I'm committing both Wordpress and Mariadb containers.
I don't have any external volumes mounted so all the work is being saved in containers.

I do remember putting check mark on drive C and D in docker settings but i don't know if that has anything to to do with volumes.

I don't get any error in my commit and moving .tar files process. Once my friend create his containers from my committed images, he gets clean Wordpress (like new installation of Wordpress starting from wp setup pages).

Another thing I noticed is that the image I create has the same file size as original image i pulled. When I run docker images, I see my image is 420MB ,as well as Wordpress image is 420MB.

I think my image should be a little bit bigger since I have installed themes, plugins and uploaded images to Wordpress. At least it should add 3 to 5 MB more then original images. Please help. Thank you.

Running docker system df gives me this.

TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              5                   3                   1.259GB             785.9MB (62%)
Containers          3                   3                   58.96kB             0B (0%)
Local Volumes       2                   2                   311.4MB             0B (0%)
Build Cache         0                   0                   0B                  0B
like image 813
smaqsood Avatar asked Jan 15 '19 03:01

smaqsood


1 Answers

Make sure, as shown here, to commit a running container (to avoid any data cleanup)

docker commit CONTAINER_ID yourImage

After the docker commit command, you can use docker save to save your image in a tar, and docker load to import it back, as shown here.

like image 128
VonC Avatar answered Oct 19 '22 08:10

VonC