Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Docker help
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Docker help

chipchip Member

Is it possible to make a backup of all my running docker containers and /or the commands used to create them to migrate to another server? ... if so how?


  • codelockcodelock Member
    edited October 2023

    @chip said: all my running docker containers

    sounds like docker compose?

    Thanked by 1chip
  • sivesive Member, Host Rep

    Docker was made to be portable, look up the networking and volumes attached and you'll be good to go on starting up new containers. Make sure to copy images over if you built them yourself.

    Thanked by 2chip sillycat
  • i have some notes from the past when backing up / restoring containers.

    -to backup-
    docker run --rm --volumes-from portainer -v $(pwd):/backup busybox tar cvfz /backup/backup.tar /data

    -to restore-
    docker run --rm --volumes-from portainer -v $(pwd):/backup busybox sh -c "cd /data && tar xvf /backup/backup.tar --strip 1"

    hopefully this is helpful!

  • therawtheraw Member
    edited October 2023

    create/use a docker private registry push all of them to private registry, pull them from new node. (remember that shared mounts files won't be included)
    or manual file (image) transfer.

  • 1q11q1 Member
    # Get a list of all running container IDs
    container_ids=$(docker ps -q)
    # Iterate through each container
    for container_id in $container_ids; do
      # Generate a unique image name based on the container ID
      # Commit the container to a new image
      docker commit "$container_id" "$new_image_name"
      echo "Saved container $container_id as $new_image_name"
Sign In or Register to comment.