Migrating Docker containers from server A to server B

Hello.

I have Odoo application running through Docker on server A and I need to migrate the containers and all their information to another server B.

The Odoo app is made up of:

  • 1 container for the postgres DB (odoo_db)
  • 1 container with Odoo app (odoo_web)

To migrate the containers, I do the following:

  1. On server A, commit the 2 containers:

docker commit db5f8856a16b odoo_db
docker commit 494b8391becf odoo_web

  1. save the 2 containers:

docker save -o odoo_db.tar odoo_db
docker save -o odoo_web.tar odoo_web

  1. On server B, load the 2 containers:

docker load -i odoo_db.tar
docker load -i odoo_web.tar

  1. run the 2 containers by entering the default postgres information and applying the --link parameter to relink the 2 containers.

docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo -e POSTGRES_DB=postgres --name odoo_db odoo_db:latest

docker run -p 8069:8069 --name odoo_web --link odoo_db:db -t odoo_web:latest

It does not work correctly. When I access the program (http://localhost:8069) the old database is not recognized.

Does anyone know how to do the migration correctly?

Hi

Have you made any persistant volumes? maybe mapped a volume into the container?
Then these methods wont save the data in the container, you need to transfer that seperatly