Skip to content

lucasdiedrich/portainer-backup-restore

 
 

Repository files navigation

Portainer backup utility

Introduction

This node app backup your Portainer objects and Docker services.

Current portainer API supported is 1.24.2

Usage

docker run --name pbk \
           -v /etc/localtime:/etc/localtime \
           -v /volumes/data/config.json:/data/default.json \
           -v /volumes/data/backup/:/data/backup/ \
           -v /var/run/docker.sock:/var/run/docker.sock \
           -d lucasdiedrich/portainer-backup

Backup

This command will create (or replace) a file named <objects>.json where all objects with Total control from portainer will be saved. A backup file is mandatory to restore objects, but it can be created by hand if you follow the backup format.

$ node . backup

The backup file are tar gzipped inside another .tgz.

Backup files format

The will one file for each portainer object available and onde aditional file for Docker services model.

Stack example file:

[
  {
    "Name": "nginx",
    "SwarmID": "jpofkc0i9uo9wtx1zesuk649w",
    "StackFileContent": "version: 3\n services:\n web:\n image:nginx"
  },
  {
    "Name": "HelloWorld",
    "SwarmID": "jpofkc0i9uo9wtx1zesuk649w",
    "StackFileContent": "version: 3\n services:\n hello-world:\n image:hello-world"

  }
]

Config file

{
  "name": "pbk-backup",
  "portainer": {
    "url": "https://exampleurl.com",
    "login": "blablabla",
    "password": "*******"
  },
  "consoleLogLevel": "trace",
  "backupFolder": "/backup",
  "disablessl": true, 
  "tmpFolder": "/tmp",
  "socketPath": "/var/run/docker.sock"
}

Initial Project

This project was built on top of portainer-backup-restore

About

Backup and restore your stacks from portainer

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • JavaScript 97.2%
  • Dockerfile 2.8%