Articles in this section

How to move Docker containers from one Plesk Server to another?

kb: how-to Plesk for Linux ext: docker

Question

How to move Docker containers from one Plesk Server to another?

Answer

The Docker extension allows to "Save as Image" existing containers and to "Upload image" to Docker for images saved locally.

Plesk now supports launching a Portainer container. Portainer is container management software that makes it easier to manage Docker containers. It also allows exporting from Docker and importing images to Docker.

Manual steps:

  1. List all running docker images and take note of their IDs:

    # docker ps --no-trunc

  2. On the source server, commit the container to an image:

    # docker commit <container_id> myimage:latest

  3. Save the new image on the source server:

    # docker save -o <image_name>.tar <image_name>:latest

  4. Transfer the container tarball to the destination server: Use a secure method to transfer the container tarball from the source server to the destination server, for example tools such as scp or rsync:

    # scp /path/to/container.tar user@destination_server:/path/to/

  5. On the destination server, load the Docker image from the tarball:

    # docker load -i <image_name>.tar

  6. After importing the container, run it on the destination server
  7. Verify and Test.

    • Verify that the container is running as expected on the destination server.
    • Check logs, ports, and any configurations specific to your application.

    Note: this procedure assumes the Docker containers are self-contained and do not have dependencies outside the container. If containers have external dependencies or volumes, they will need to be managed accordingly. Additional proxy_pass directives for nginx are migrated via Plesk Migrator but should be reviewed nonetheless under container verification procedures.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.