How to move docker containers between different hosts

I cannot find a way of moving docker running containers from one host to another.

Is there any way I can push my containers to repos like we do it for images ?
Currently I am not using data volumes to store the data associated with applications running inside containers. So some data resides inside containers which I want to persist before redesigning the setup.

  • Docker ps and other subcommands all hang forever on CentOS 7.2
  • Google Container Engine Expose Service “Site Cannot Be Reached”
  • How to programmatically know if I am building with -prod flag (ng build -prod)
  • How can I make docker-machine create a VM in a specific location
  • Docker Compose Links not working with Host mode
  • Why doesn't the container start?
  • Any help is appreciated.

  • Docker jetty container JVM memory allocation
  • Best practice for connecting to a vpn though docker [closed]
  • Docker Dev: Golang: Is Layer.Size() equivalent to the sum of Metadata.Size in []layer.Metadata?
  • How to organize containers “horizontally” inside Kubernetes pods?
  • What's the best way to synchronize a python script with a docker database container?
  • docker image of sonarqube is not running with mysql db configuration
  • 3 Solutions collect form web for “How to move docker containers between different hosts”

    You cannot move a running docker container from one host to another.

    You can commit the changes in your container to an image with docker commit, move the image onto a new host, and then start a new container with docker run. This will preserve any data that your application has created inside the container.

    alternatively, if you do not wish to push to a repository:

    1) Export the container to a tarball

         docker export <CONTAINER ID> > /home/export.tar
    

    2) Move your tarball to new machine

    3) Import it back

         cat /home/export.tar | docker import - some-name:latest
    

    From Docker documentation:

    docker export does not export the contents of volumes associated
    with the container. If a volume is mounted on top of an existing
    directory in the container, docker export will export the contents
    of the underlying directory, not the contents of the volume. Refer
    to Backup, restore, or migrate data
    volumes
    in the user guide for examples on exporting data in a volume.

    Other external tools:
    In order to move a container with its associated data volume you can use Flocker https://clusterhq.com/flocker/introduction/

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.