How to migrate a peertube docker instance to another host

I have setup a docker instance of peertube. Now I have to move the docker instance to another host. Should i backup and move every dependent containers explicitly. Or just backing up the main docker instance is enough; Please share any tips and links for doing this .
Output of my docker ps command.

CONTAINER ID        IMAGE                                   COMMAND                  CREATED             STATUS              PORTS               NAMES
9a1a083c32fd        chocobozzz/peertube:production-buster   "/usr/local/bin/dock…"   5 weeks ago         Up 5 weeks          9000/tcp            peertube_peertube_1
b27afcfb102b        redis:4-alpine                          "docker-entrypoint.s…"   5 weeks ago         Up 5 weeks          6379/tcp            peertube_redis_1
a1c8b45bead1        traefik:v1.7                            "/traefik --docker -…"   5 weeks ago         Up 5 weeks                              peertube_reverse-proxy_1
0298274f765a        mwader/postfix-relay                    "/root/run"              5 weeks ago         Up 5 weeks          25/tcp              peertube_postfix_1
f7f05ac30946        postgres:10-alpine                      "docker-entrypoint.s…"   5 weeks ago         Up 5 weeks          5432/tcp            peertube_postgres_1

Not an expert at all on PeerTube, but please consider two facts on docker:

  • your data inside the container will be lost when you delete it, it’s a transcient layer. The good news is that you just have to pull images on your new host in order to make it work again
  • the data that matters should be stored outside the container, using -v <host_path>:<container_path> option, this is the data you want to copy to the new host. I guess you can find out those folders by looking to the COMMAND returned by docker ps

If the separation between your data and container hasn’t been made at setup, you shoud first copy folders that matters (listed in Peertube documentation I suppose) on your host and then map volumes as describe previously.

Having followed is it sufficient to

  1. copy .env file to the new server
  2. copy docker-compose.yml file to the new server (just in case they’d be breaking changes)
  3. stop the container
  4. copy docker-volume directory to the new server in the same relative path
  5. update the DNS for the new server to reflect the same configured domain
  6. run docker-compose up

or is there a better way?

I think it’s the way to go

1 Like