Create Backup Docker and Portainer

  • Hi,


    is there a simple guide for a newcomer and little knowledge of Linux how I can backup and restore selected Docker containers, portainer settings, images (Pihole, OpenVpn)?


    If my SD card crashes or I want to set up the whole thing again, I simply want to create the containers again in Portainer. It is important that all my settings and functions run again immediately!


    Maybe there is also a graphic plugin for Openmediavault 5 to secure individual containers.


    Thanks a lot

  • If you set an individual share and use it as docker root (you can do so in OMV-Extras -> Docker), you are able to backup it to an external drive with OMVs own USB backup plugin. If you set up your containers through docker compose files or portainer stacks, these definitions contain everything needed to restore complete functionality of your containers. Setup of container volumes within the shared docker folder is required.

    Chaos is found in greatest abundance wherever order is being sought.
    It always defeats order, because it is better organized.
    Terry Pratchett

  • There is an app that can generate docker compose file, do a search in the forum.

    If you want to be safe, you can clone entire OMV drive by using Clonezilla.

    OMV v5.0
    Asus Z97-A/3.1; i3-4370
    32GB RAM Corsair Vengeance Pro

  • If you want to create a docker-compose file from a running docker container, run this in the shell. You can redirect it to a file if you wish.


    Code
    docker run --rm -v /var/run/docker.sock:/var/run/docker.sock red5d/docker-autocompose:latest container_name

    --
    Google is your friend and Bob's your uncle!


    OMV AMD64 7.x on headless Chenbro NR12000 1U 1x 8m Quad Core E3-1220 3.1GHz 32GB ECC RAM.

  • Hello, I have now set up the following planned script. I hope it works.


    Code
    sudo systemctl stop docker && sudo rsync -ahhvX --stats --progress --delete /var/lib/docker/ /srv/dev-disk-by-label-Data/Data/Backup/Backup-Docker-System && sudo systemctl start docker
  • In theory yes. If you Nextcloud db resides in a docker volume instead of a bind mount.

    But as always, you need to test your backup method yourself before relying on it.

    Also turn on Nextcloud maintenance mode before backing up the database.

  • That really is a matter of personal flavor.

    You have to see what a exactly you want to backup. Only the nextcloud db? Or also the nextcloud files? Do want to backup your other dockers as well?

    Where do you keep the persistent data of your containers?

  • I want to backup all data from all containers (when my OMV build will be installed) so DB, files, etc... I'll have at least a Nextcloud, a Plex or Emby, a Bitwarden and perhaps others containers in the future.

    I plan to keep the persistant data to a dedicated drive or at least a dedicated folder (I don't know if it will be a HDD or SSD). Plex or Emby media files will not be included in persistent data, it will be separated.

    Thank you.

  • Until now I didn't use Docker so I don't know backup methods available, I'm very new to Docker :)

    To backup my medias I just do a sync between my storage to external disks, to backup my VM I use Veeam but to backup Docker I don't know.

  • First advice would be to change the docker root directory to one of your data disks. this can be done via the omv-extras interface.

    Usually when setting up docker containers the persistant data is bind mounted to a specific folder on your system. If you pool these in a folder, the folder can be easily backed up with rsync. Just make sure stop the docker containers or stop writing to the db (e.g. by enabling maintenance mode in nc) before starting the backup.

  • Thank you, I'll look at it.

    Yes I will use a personal folder to store persistent data from Docker.

    Is there a script example or a little tool to manage backups (stop container or stop DB or enable maintenance for NC) ?

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!