0

I have two docker containers, one for Wordpress files and another for the WP mysql database connected to my files.

  docker ps
  CONTAINER ID   IMAGE              COMMAND                  CREATED                STATUS          PORTS                 NAMES
  dc0bfbc38742   wordpress:latest   "docker-entrypoint.s…"   8 minutes ago    Up 8 minutes    0.0.0.0:80->80/tcp    wp_hoho-wordpress-1
  974cdc1b6162   mysql:5.7          "docker-entrypoint.s…"   22 minutes ago   Up 22 minutes   3306/tcp, 33060/tcp   wp_hoho-db-1

am trying to save an image and move a working copy to another machine so I did commit

  docker commit dc0bfbc38742 myfiles
  docker commit 974cdc1b6162 mydb

then I saved both

 docker save myfiles > myfiles.tar
 docker save mydb > mydb.tar

however when I load them to the other machine the copies are empty without my files or the db created.

 docker load < mydb.tar
 docker load < myfiles.tar

the database is there but without tables.

I ran the image by

 docker run "the image on the new server for MYDB"
 docker run -p 80:80 "the image on the new server for MYfiles"

error that I got for the files image

 WordPress not found in /var/www/html - copying now...
 Complete! WordPress has been successfully copied to /var/www/html
  No 'wp-config.php' found in /var/www/html, but  'WORDPRESS_...' variables supplied; copying 'wp-config-docker.php'       (WORDPRESS_DB_HOST WORDPRESS_DB_NAME WORDPRESS_DB_PASSWORD WORDPRESS_DB_USER)

so I guess docker is copying new installation files

the mysql got the same issue I guess that's why it created the db and user but didn't create the tables.

any idea what's the problem?

cocojumbo
  • 13
  • 3
  • `docker commit` on a database image won't include the database data, since it's always stored in a volume. If all of your local modifications to the Wordpress container are in `/var/www/html`, committing won't include them for the same reason. In general using `docker commit` is almost never a best practice, though. The linked questions describe some approaches to migrate the volume data. – David Maze Apr 15 '22 at 18:52

0 Answers0