Skip to content

Manual backup and restore ​

This guide saves everything with Docker commands: the data volume, your .env file, the installer information, and the Docker image. Use it before upgrades or to move Nimbot to another server. For everyday backups, the panel backup is easier.

WARNING

Nimbot stops during the backup. Tasks in progress may be interrupted. Copying files while Nimbot runs, or copying only agent folders, does not make a reliable backup.

Back up ​

  1. Set container and data_volume as shown in Everyday commands.
  2. Open a Bash terminal in the folder that contains your .env.
  3. Run:
sh
(
  set -euo pipefail
  umask 077
  backup_dir="$PWD/.nimbot-backups/$(date -u +%Y%m%dT%H%M%SZ)"
  mkdir -p "$PWD/.nimbot-backups"
  mkdir "$backup_dir"
  backup_image=$(docker container inspect --format '{{.Image}}' "$container")
  docker stop --time 30 "$container"
  docker run --rm --user 0:0 \
    --mount "type=volume,source=$data_volume,target=/data,readonly" \
    --entrypoint tar "$backup_image" -czf - -C /data . > "$backup_dir/data.tar.gz.tmp"
  tar -tzf "$backup_dir/data.tar.gz.tmp" > /dev/null
  mv "$backup_dir/data.tar.gz.tmp" "$backup_dir/data.tar.gz"
  cp .env "$backup_dir/env.backup"
  if [ -f .nimbot-installation ]; then cp .nimbot-installation "$backup_dir/installation.backup"; fi
  printf '%s\n' "$backup_image" > "$backup_dir/image-id"
  docker image save "$backup_image" | gzip > "$backup_dir/image.tar.gz"
  docker start "$container"
  printf 'Backup: %s\n' "$backup_dir"
)
  1. Copy the printed backup folder to another machine.

If the backup fails, Nimbot stays stopped. Check the error before starting it again.

Restore ​

Restoring creates a new container and volume from the backup, so your current data isn't touched until you're sure everything works.

Stop the old installation first

Two installations must never run with the same bots at the same time. Stop the original Nimbot (even on another server) before starting the restored one.

  1. Copy the backup folder to the destination server.
  2. Open a terminal in an empty folder (the restored .env will go there).
  3. Set backup_dir and panel_port in the block below to your values, then run it:
sh
(
  set -euo pipefail
  umask 077
  backup_dir=/absolute/path/to/backup
  docker image load --input "$backup_dir/image.tar.gz"
  restored_image=$(cat "$backup_dir/image-id")
  docker image inspect "$restored_image" > /dev/null
  restored_volume="nimbot-restored-$(od -An -N16 -tx1 /dev/urandom | tr -d ' \n')"
  docker volume create "$restored_volume"
  docker run --rm -i --user 0:0 \
    --mount "type=volume,source=$restored_volume,target=/data" \
    --entrypoint tar "$restored_image" --numeric-owner -xzpf - -C /data < "$backup_dir/data.tar.gz"
  cp "$backup_dir/env.backup" .env
  chmod 600 .env
  panel_port=3000
  docker run -d --init --name nimbot-recovered --restart unless-stopped --stop-timeout 30 \
    --env-file .env --publish "127.0.0.1:$panel_port:3000" \
    --mount "type=volume,source=$restored_volume,target=/data" "$restored_image"
  printf 'Recovered container: nimbot-recovered\nData volume: %s\n' "$restored_volume"
)
  1. Sign in and check your agents, files, AI providers, and schedules.

Good to know ​

  • Anything that changed after the backup is lost when you restore it.
  • Tasks that were interrupted are not run again. Agents you had stopped stay stopped.
  • If nimbot-recovered already exists, change the container name in the block.
  • Keep PANEL_URL in .env matching the address you use in the browser.
  • The restored installation is managed with Docker commands, not with the installer's uninstall script.
  • Keep the original volume and backup until you've confirmed the restore works.
Running Nimbot without Docker

Stop Nimbot and all agents, then archive the whole SERVER_STATE_DIR folder and .env with a tool that keeps file owners and permissions. Restore to a new folder owned by the same user. Native development uses .nimbot-native/ by default.