This guide covers the process of migrating a Headscale setup from a CentOS 7 system to Ubuntu 24, including steps for exporting configurations, database, and Docker images, as well as importing them on the new system.

1. Export Data and Image on CentOS 7

Export Configuration and Database

To begin, export the configuration and database files from the headscale container:

docker cp headscale:/etc/headscale/config.yaml ./config.yaml
docker cp headscale:/etc/headscale/db.sqlite ./db.sqlite

Export Docker Image

Use docker save to export the headscale Docker image:

docker save -o headscale_image_backup.tar headscale/headscale:0.23.0-beta1

2. Transfer Files to Ubuntu 24

Transfer the configuration, database, and image files to the Ubuntu 24 system using scp, rsync, or another file transfer tool:

scp config.yaml db.sqlite headscale_image_backup.tar user@ubuntu-server:/path/to/backup/

3. Import Data on Ubuntu 24

Load Docker Image

On the Ubuntu system, use docker load to import the Docker image:

docker load -i /path/to/backup/headscale_image_backup.tar

Create Headscale Container

Move the configuration and database files to /etc/headscale/ and create the container: