Skip to content

Instantly share code, notes, and snippets.

@Meldiron
Last active February 23, 2026 13:24
Show Gist options
  • Select an option

  • Save Meldiron/47b5851663668102a676aff43c6341f7 to your computer and use it in GitHub Desktop.

Select an option

Save Meldiron/47b5851663668102a676aff43c6341f7 to your computer and use it in GitHub Desktop.
Backup and Restore Appwrite, the lazy way 🐌
# Make sure to stop Appwrite before this backup, and make sure you have enough space on the machine
docker run --rm \
-v appwrite_appwrite-mariadb:/backup/appwrite-mariadb \
-v appwrite_appwrite-redis:/backup/appwrite-redis \
-v appwrite_appwrite-cache:/backup/appwrite-cache \
-v appwrite_appwrite-uploads:/backup/appwrite-uploads \
-v appwrite_appwrite-certificates:/backup/appwrite-certificates \
-v appwrite_appwrite-functions:/backup/appwrite-functions \
-v appwrite_appwrite-influxdb:/backup/appwrite-influxdb \
-v appwrite_appwrite-config:/backup/appwrite-config \
-v appwrite_appwrite-builds:/backup/appwrite-builds \
-v $(pwd)/backups:/archive \
--env BACKUP_FILENAME="backup-%Y-%m-%dT%H-%M-%S.tar.gz" \
--entrypoint backup \
offen/docker-volume-backup:latest
# Makre sure the Appwrite did NOT run on this server, and make sure to stop it before this restore. If appwrite ran here already, make sure to stop Appwrite with 'docker-compose down -v'.
# Before running, be in any directory, but make sure `backup.tar.gz` file with your backup is in there
# After restore, make sure to also copy 'docker-compose.yml' and '.env' from the previous server.
# Untar backup
tar -C /tmp -xvf backup.tar.gz
# Restore mariadb
docker run -d --name temp_restore_container -v appwrite_appwrite-mariadb:/backup_restore/appwrite-mariadb alpine
docker cp /tmp/backup/appwrite-mariadb temp_restore_container:/backup_restore
docker stop temp_restore_container
docker rm temp_restore_container
# Restore redis
docker run -d --name temp_restore_container -v appwrite_appwrite-redis:/backup_restore/appwrite-redis alpine
docker cp /tmp/backup/appwrite-redis temp_restore_container:/backup_restore
docker stop temp_restore_container
docker rm temp_restore_container
# Restore cache
docker run -d --name temp_restore_container -v appwrite_appwrite-cache:/backup_restore/appwrite-cache alpine
docker cp /tmp/backup/appwrite-cache temp_restore_container:/backup_restore
docker stop temp_restore_container
docker rm temp_restore_container
# Restore uploads
docker run -d --name temp_restore_container -v appwrite_appwrite-uploads:/backup_restore/appwrite-uploads alpine
docker cp /tmp/backup/appwrite-uploads temp_restore_container:/backup_restore
docker stop temp_restore_container
docker rm temp_restore_container
# Restore certificates
docker run -d --name temp_restore_container -v appwrite_appwrite-certificates:/backup_restore/appwrite-certificates alpine
docker cp /tmp/backup/appwrite-certificates temp_restore_container:/backup_restore
docker stop temp_restore_container
docker rm temp_restore_container
# Restore functions
docker run -d --name temp_restore_container -v appwrite_appwrite-functions:/backup_restore/appwrite-functions alpine
docker cp /tmp/backup/appwrite-functions temp_restore_container:/backup_restore
docker stop temp_restore_container
docker rm temp_restore_container
# Restore influxdb
docker run -d --name temp_restore_container -v appwrite_appwrite-influxdb:/backup_restore/appwrite-influxdb alpine
docker cp /tmp/backup/appwrite-influxdb temp_restore_container:/backup_restore
docker stop temp_restore_container
docker rm temp_restore_container
# Restore config
docker run -d --name temp_restore_container -v appwrite_appwrite-config:/backup_restore/appwrite-config alpine
docker cp /tmp/backup/appwrite-config temp_restore_container:/backup_restore
docker stop temp_restore_container
docker rm temp_restore_container
# Restore builds
docker run -d --name temp_restore_container -v appwrite_appwrite-builds:/backup_restore/appwrite-builds alpine
docker cp /tmp/backup/appwrite-builds temp_restore_container:/backup_restore
docker stop temp_restore_container
docker rm temp_restore_container
@lucasctd
Copy link
Copy Markdown

Hello Buddy, hope you are doing well.

I tried to run your script but the docker-compose.yml and .env files are being created as folders XD

drwxr-xr-x 2 lucas lucas 4096 mai 21 23:23 docker-compose.yml/
drwxr-xr-x 2 lucas lucas 4096 mai 21 23:23 .env/

any idea of what could be wrong?
I am running docker on Ubuntu 22.04.2 LTS

@lucasctd
Copy link
Copy Markdown

I've used the docker-compose.yaml and .env I have in my server and just needed to add external: true to each volume in order to be able to attach them to my containers:

volumes:
  appwrite-mariadb:
    external: true
  appwrite-redis:
    external: true
  appwrite-cache:
    external: true
  appwrite-uploads:
    external: true
  appwrite-certificates:
    external: true
  appwrite-functions:
    external: true
  appwrite-builds:
    external: true
  appwrite-influxdb:
    external: true
  appwrite-config:
    external: true
  appwrite-executor:
    external: true

otherwise I would get the warning below:

Warning: "volume [volume name] already exists but was not created by Docker Compose. Use external: true to use an existing volume"

I also had to remove the appwrite_ prefix from your scripts since the containers are not expecting the volumes to have that prefix :D

Thanks for you hard work anyway.

@luokelong
Copy link
Copy Markdown

After restore and run "docker-compose up -d" command I got the errors:

WARN[0000] volume "appwrite_appwrite-uploads" already exists but was not created by Docker Compose. Use `external: true` to use an existing volume
WARN[0000] volume "appwrite_appwrite-redis" already exists but was not created by Docker Compose. Use `external: true` to use an existing volume
WARN[0000] volume "appwrite_appwrite-functions" already exists but was not created by Docker Compose. Use `external: true` to use an existing volume
WARN[0000] volume "appwrite_appwrite-builds" already exists but was not created by Docker Compose. Use `external: true` to use an existing volume
WARN[0000] volume "appwrite_appwrite-cache" already exists but was not created by Docker Compose. Use `external: true` to use an existing volume
WARN[0000] volume "appwrite_appwrite-certificates" already exists but was not created by Docker Compose. Use `external: true` to use an existing volume
WARN[0000] volume "appwrite_appwrite-mariadb" already exists but was not created by Docker Compose. Use `external: true` to use an existing volume
WARN[0000] volume "appwrite_appwrite-influxdb" already exists but was not created by Docker Compose. Use `external: true` to use an existing volume
WARN[0000] volume "appwrite_appwrite-config" already exists but was not created by Docker Compose. Use `external: true` to use an existing volume

Then, I added "external: true" under each volume.
Got error:

external volume "[volume name]" not found

What is wrong?

@joeyouss
Copy link
Copy Markdown

Hi there πŸ‘‹πŸ»
Please make sure that Appwrite did NOT run on this server previously. The error says it was found which implies Appwrite did run there.

@lucasctd
Copy link
Copy Markdown

lucasctd commented May 30, 2023

@joeyouss hey, it's not the case. The script will restore the volumes that's why we see that message.

@luokelong so, the service is looking for a volume named as appwrite-builds but the script creates it as appwrite_appwrite-builds that's why it fails.

I had to remove the appwrite_ prefix from the script to make it work.

In fact, if you look at your current server, you'll see the volumes were created there with that prefix so I have no idea why it works in my old server, even though it has a prefix there, but does not work after the restoration (I am using the same docker-compose.yml from the production server)

@aallnneess
Copy link
Copy Markdown

Hey,
I just wanted to give you quick feedback that it worked 100% perfectly for me.
thanks great!

@barart
Copy link
Copy Markdown

barart commented Mar 14, 2024

Make sure to stop Appwrite before this backup

^^ by this you mean stop all containers? or just appwrite container?

@lucasctd
Copy link
Copy Markdown

@barart I think it's only the appwrite containers

@liudonghua123
Copy link
Copy Markdown

Does it work for https://appwrite.io/docs/advanced/self-hosting#manual, I use docker-compose.yml and .env. And I also have updated some configurations on .env file.

@larmaysee
Copy link
Copy Markdown

larmaysee commented May 30, 2025

i'm not sure that even i restore success, there is no my data anymore in the database as well as console users. Any thought? backup sql dump as well?

@a-l-e-c
Copy link
Copy Markdown

a-l-e-c commented Nov 10, 2025

Can confirm that restore procedure worked after updating the following lines in my docker-compose.yml:

traefik-volumes:

      - appwrite_appwrite-config:/storage/config:ro
      - appwrite_appwrite-certificates:/storage/certificates:ro

appwrite-volumes:

      - appwrite_appwrite-uploads:/storage/uploads:rw
      - appwrite_appwrite-cache:/storage/cache:rw
      - appwrite_appwrite-config:/storage/config:rw
      - appwrite_appwrite-certificates:/storage/certificates:rw
      - appwrite_appwrite-functions:/storage/functions:rw

appwrite-worker-deletes-volumes:

      - appwrite_appwrite-uploads:/storage/uploads:rw
      - appwrite_appwrite-cache:/storage/cache:rw
      - appwrite_appwrite-functions:/storage/functions:rw
      - appwrite_appwrite-builds:/storage/builds:rw
      - appwrite_appwrite-certificates:/storage/certificates:rw

appwrite-worker-builds-volumes:

      - appwrite_appwrite-functions:/storage/functions:rw
      - appwrite_appwrite-builds:/storage/builds:rw

appwrite-worker-certificates-volumes:

      - appwrite_appwrite-config:/storage/config:rw
      - appwrite_appwrite-certificates:/storage/certificates:rw

appwrite-worker-messaging-volumes:

      - appwrite_appwrite-uploads:/storage/uploads:rw

openruntimes-executor-volumes:

      - appwrite_appwrite-builds:/storage/builds:rw
      - appwrite_appwrite-functions:/storage/functions:rw

mariadb-volumes:

      - appwrite_appwrite-mariadb:/var/lib/mysql:rw

redis-volumes:

      - appwrite_appwrite-redis:/data:rw

Finally, at the very end of the docker-compose file I just added exteral-true to all:

volumes:
  appwrite_appwrite-mariadb:
    external: true
  appwrite_appwrite-redis:
    external: true
  appwrite_appwrite-cache:
    external: true
  appwrite_appwrite-uploads:
    external: true
  appwrite_appwrite-certificates:
    external: true
  appwrite_appwrite-functions:
    external: true
  appwrite_appwrite-builds:
    external: true
  appwrite_appwrite-config:
    external: true

What I haven't done yet is upgrade my version (1.6.x) to check if I can rename those volumes again. But the restore worked and was able to recover my data. Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment