Mirgrating all data to new server

We recently started migrating our servers to new hardware. Part of this is our docker server that has a bunch of containers. I’m trying migrate the volumes over, but not 100% sure the best way to do this. I tried specifying the volume location in the yml file, but that does not seem to work. Any help on this would be greatly appreciated.

Hi

How did you do it and why dosnt it seem to work?

One possibility is to start a dummy busybox container with the volume mounted and then simply tar the contents to a mount.

So I inspected the the container and looked at where the volume was mounted. I then stopped the container, committed it and then saved it to a tar. I used winscp to copy the tar and volume folders over to the new server. I then loaded it and specified the volume. Realised after all this that I used docker-compose… so I edited my comose file to look like this:

services:

  db:
    image: mysql:latest
    volumes:
      -/var/lib/docker/volumes/36667d6cb785433cda3deaa03c29ac4e84e53a96b587fe4dea9a3836435dcebf/_data
    ports:

Then I get an error:

ERROR: The Compose file './docker-compose.yml' is invalid because:
services.db.volumes contains an invalid type, it should be an array

Hi again.

No that wont work, can i ask what folder in the container you want to backup ?

I want to backup literally everything from every container and move them to a completely new host.

Yes, but ALOT of the contents in a container, is defined by the image, so when you pull the image again, the application and dependencies is allready there, so what you want to backup is YOUR data, the data generated.

fx. if it was a mysql, you would backup the datadir, so you’re sure that your database is backed up, but you dont want to backup the mysql software, because thats the image itself.