Skip to content

Backups

Johnny Knighten edited this page Jan 22, 2024 · 1 revision

Backup On Container Stop - Docker Timeout Considerations

By default once a docker image is stopped/killed it has 10 seconds before all remaining running process are force killed. The BACKUP_ON_STOP backup setting is designed in such a way that the backup process will always be one of the last processes running. As your server files grow so will the duration it takes to backup(and tar.gz/zip) your files. Because of this, there is a non-trivial chance that your backup process may get stopped in the middle of performing a backup. To combat this, you will need to adjust the timeout settings of your docker run/stop/compose command.

In general all of the internal process management settings allow a max wait time of 600 seconds. I suggest using 600 as your timeout in the upcoming examples.

Docker Run/Stop

If you execute a docker run command not detached (without the -d param) you will need to use the --stop-timeout parameter.

$ docker run --stop-time 600 ... OTHER SETTINGS HERE ...johnnyknighten/palwolrd-server:latest

When you hit CTRL+C the timeout will be 600 seconds until the final process is killed, ensuring enough time for your backup to complete.

See the stop-timeout documentation section of the official docker run docs for more info.

If you execute a docker run command detached (with the -d param) you will need to use the docker stop command with the -t parameter.

$ docker run -d --name ark ... OTHER SETTINGS HERE ...johnnyknighten/palwolrd-server:latest
$ docker stop -t 600 ark

Docker Compose

If you execute a docker compose up command not detached (without the -d param) you will need to use the -t parameter.

$ docker compose up -t 600

When you hit CTRL+C the timeout will be 600 seconds until the final process is killed, ensuring enough time for your backup to complete.

If you execute a docker compose up command detached (with the -d param) you will need to use the docker compose down command with the -t parameter.

$ docker compose up -d
$ docker compose down -t 600
Clone this wiki locally