Docker Community Forums

Share and learn in the Docker community.

Saved Docker image is not the same when loaded on another machine

docker

(Burizz) #1

Hello Everyone,

We have a problem when saving docker images and loading them on another machine (running the same OS) not all files are the same. Some symlinks are lost within apache directory.

We do the following:

  1. $ docker commit [container ID] [image_name]
  2. $ docker save > [image_name].tar
  3. Copying the image on another machine running exactly the same OS (In fact it is a cloned VM, so it is exactly the same).
  4. $ docker load < [image_name].tar
  5. $ docker run --name [container_name] --link [link_wordpress_to_db]:mysql -e WORDPRESS_DB_USER=[user] -e WORDPRESS_DB_PASSWORD=[pass] -e WORDPRESS_DB_NAME=[db_name] -p 8080:80 -d [image_name]

Container is started and most things are exaclty the same. Except the /var/www/html directory.
In the original container we have symlinks of most files to /home/[wp-user]/public_html.
However, in the new container (created from the saved and loaded image) we have the original wordpress files.

TL DR;
For some reason saving and loading the image does not copy the symlinks from /var/www/html properly. Even their ownership is still www-data, although in the original container they are owned by root and [wp-user].

OS
DISTRIB_DESCRIPTION="CoreOS 766.5.0"
DISTRIB_RELEASE=766.5.0
DISTRIB_CODENAME=“Red Dog”

Kernel
Linux localhost 4.1.7-coreos-r1 #2 SMP Thu Nov 5 02:10:23 UTC 2015 x86_64 Intel® Xeon® CPU E5-2620 0 @ 2.00GHz GenuineIntel GNU/Linux

Docker version 1.7.1, build df2f73d-dirty

Both servers run as VMs on VMWARE ESXi and are cloned so they are exactly the same.