How to move a containerized application to a different host? We have a forum application made of two containers: a container for the database, and another one for the bulletin board application itself. Both containers are running on the same host for quite some time now. That application does not follow the "microservice" architecture since the database files are stored in the writable layer of the database container. And the configuration settings of the forum were directly set up in the writable layer of the bulletin board application.

We would like to migrate that forum to a different host since the current server has reached end-of-life. We see two ways of doing that:


using docker commit to make an image of both containers, then uploading those images to a repository and pulling them back from the new host.
using docker export to create archives of the container filesystems, and importing them on the new host.


What are the pro and cons of both approaches for ad-hoc container migration? Is there a better-suited solution for our specific needs?
From what I understand of https://stackoverflow.com/questions/28734086/how-to-move-docker-containers-between-different-hosts, docker export will only save the container filesystem. But no metadata such as the default command, leading to that error when you try to run the imported archive:

sh# IMAGE=$(docker import phpbb.tar)                                                                                                                                       
sh# docker run "${IMAGE}"
docker: Error response from daemon: No command specified.



Given my need, it is sufficient to docker commit the container to a new image, then docker save the image, and finally docker load and docker run it on the new host:

old# docker commit CONTAINER name:tag
old# docker save name:tag |gzip &gt; archive.tar.gz
old# scp archive.tar.gz root@new:.




new# docker load &lt; archive.tar.gz
new# docker run name:latest


It is important to save the image by repository name:tag and not by id to preserve the tag in the archive.