当前位置: 首页 > news >正文

imm docker 备份/迁移

备份篇

可选,备份镜像,大小1GB,但是docker pull一万年,所以最好备份一下。

# 创建镜像导出脚本
cat > export-images.sh << 'EOF'
#!/bin/bash
IMAGES=("ghcr.io/immich-app/immich-server:v2""ghcr.io/immich-app/immich-machine-learning:v2""docker.io/valkey/valkey:8@sha256:81db6d39e1bba3b3ff32bd3a1b19a6d69690f94a3954ec131277b9a26b95b3aa""ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:bcf63357191b76a916ae5eb93464d65c07511da41e3bf7a8416db519b40b1c23"
)# echo "正在拉取最新镜像..."
# docker compose pullecho "正在导出镜像(约需几分钟)..."
docker save "${IMAGES[@]}" | gzip > immich-images.tar.gzecho "镜像导出完成!大小:"
ls -lh immich-images.tar.gz
EOF# 运行脚本
chmod +x export-images.sh
./export-images.sh

备份数据库:

# Replace <DB_USERNAME> with the database username - usually postgres unless you have changed it.
docker exec -t immich_postgres pg_dumpall --clean --if-exists --username=<DB_USERNAME> | gzip > "/path/to/backup/dump.sql.gz"

备份另外两个文件夹。这里跳过

恢复篇

恢复镜像

cd ~/imm# 导入镜像(约需几分钟)
docker load -i /tmp/immich-images.tar.gz# 验证导入
docker images | grep immich

恢复两个文件夹

恢复数据库

docker compose down -v  # CAUTION! Deletes all Immich data to start from scratch
## Uncomment the next line and replace DB_DATA_LOCATION with your Postgres path to permanently reset the Postgres database
# rm -rf DB_DATA_LOCATION # CAUTION! Deletes all Immich data to start from scratch
docker compose pull             # Update to latest version of Immich (if desired)
docker compose create           # Create Docker containers for Immich apps without running them
docker start immich_postgres    # Start Postgres server
sleep 10                        # Wait for Postgres server to start up
# Check the database user if you deviated from the default
# Replace <DB_USERNAME> with the database username - usually postgres unless you have changed it.
gunzip --stdout "/path/to/backup/dump.sql.gz" \
| sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \
| docker exec -i immich_postgres psql --dbname=postgres --username=<DB_USERNAME>  # Restore Backup
docker compose up -d            # Start remainder of Immich apps
http://www.zskr.cn/news/50723.html

相关文章:

  • abc326-d 题解
  • 搭建一个CTF比赛平台的经过
  • 四、Agent原理与ReAct 架构详解 ——《动手学Agent应用开发》学习心得
  • InterStellar
  • 每日反思(2025_11_15)
  • 猫树
  • Rust 解析验证码(结合 Tesseract OCR)
  • 『回忆录』高二上半期考试
  • 轮胎内喷涂优惠工具趋势分析报告
  • Spring AI Alibaba 项目源码学习(七)-Agent、BaseAgent、ReactAgent 分析
  • KEYDIY KD ZB28-3 Universal Hyundai Smart Remote Key (5pcs/lot) – Reliable Replacement
  • Yanhua Mini ACDP-2 A303 Volvo 2022+ IMMO License for ACDP-2 Module20
  • 西电TIC带鱼杯新生训练赛复盘
  • 20251115 - 从零到1详细剖析STM32的CAN架构【以STM32F407为例】
  • 2025 CSP-S 趋势记
  • 鲜花:记梦4
  • invalid literal for int() with base 10: abc中的base 10是什么意思? 另外它是怎么知道abc的?
  • byd秘钥 - MKT
  • NSubstitute之Substitute.ForT
  • 第4章 AI项目管理新范式:从交付功能到交付价值
  • C++ QT_数据转换(数值、QString、QByteArray、结构体)
  • 第3章 传统项目管理在AI中的局限
  • multisim 13 Problem: Accessing the database解决办法
  • AI元人文框架:意义世界的探索引擎
  • abc432
  • 20232310 2025-2026-1 《网络与系统攻防技术》实验五实验报告
  • 公告栏
  • 生物化学课程笔记
  • PELT算法浅析
  • hippy字节都在用的前端主流框架