Migrate real InfluxDB data into containerized InfluxDB

2026. 03. 16.

I've just moved my real influxdb2 data from my Rpi 4 to containerized influxdb. Quite simple.

Intro

I just started a process to eliminate my rpi 4 from my local infra and move the services into my DS 923+ Syno NAS. All the servicess I am using on my rpi are available through Docker, so I started to convert them into shiny containers. The first two (Plex and Mosquitto) were done quiet easily, but influxdb was a little different. I wanted to keep all the data I already collected, so a data migration was needed.

Creating the containerized influxdb

It was as easy as it is described in docs. I just prepped the docker-compose.yml file for my needs and spinned up the container. So here is my config:

version: '2'

services:
  influxdb:
    image: influxdb:latest
    container_name: influxdb
    network_mode: host
    volumes:
      - /volume1/docker/influxdb/restore:/tmp/restore
      - /volume1/docker/influxdb/data:/var/lib/influxdb2
    restart:
      always

I just added the /restore folder to the container as well under /tmp. I'll use this folder to restore the backup created on my rpi host and a small shell script the reconfigure influxdb in the container as it is noted in the influx doc as well.

Because I need my influxdb to be accessible without interruption, I changed the network mode to host. This ensures that influxdb will be accessible using my NAS' IP address on port 8086 (default influxdb port).

Preparation

So, on the persistence volume /restore (the NAS) I just copied the fresh export from my real influxdb. For example:

/volume1/docker/influxdb/restore/influxdb_backup_2026-03-16_19-30/
    | - 20260316T183001Z.<N>.tar
    | - 20260316T183001Z.bolt
    | - 20260316T183001Z.manifest
    | - 20260316T183001Z.sqlite.gz

As I mentioned, also created a small bash script (setup.sh) to avoid typing in the container itself. The script was the following:

#!/bin/bash

influx setup --username <admin> --password <pwd> --org <org> --bucket <bucket> --retention 0 --token <token>

where:

  • <admin> is the original admin user from the source influxdb server
  • <pwd> is the password for the admin user
  • <org> is the default organization from the source influxdb server
  • <bucket> is the bucket created on the original influxdb server
  • <token> is the admin's token to get access to the server through API

Let's restore

  1. Start the container and open a bash console for it.
  2. Change inside the container to /tmp/restore (or where you mounted the folder; in my case it was /tmp/restore but you can cross-check in docker-compose.yml).
  3. Add execution flag (+x - chmod +x setup.sh) to the shell script and execute it.
  4. Restore the data:
influx restore /tmp/restore/influxdb_backup_2026-03-16_19-30/ --full

You are done. Now you can stop the container, remove the volume about /restore. Start the container again and check you have all the data by logging into influx web UI.