-
Notifications
You must be signed in to change notification settings - Fork 1
Usage
cav94mat edited this page Aug 2, 2020
·
4 revisions
Options and input stacks must be specified on the command line, or through environment variables:
docker-maintenance [<<options>>] [--] <<stacks>> ... [<<options>>] [--] <<stacks>>]
Command-line | Environment | Description | Local | Container |
---|---|---|---|---|
--dry , --dry-run
|
Dry run (does nothing, only logging) | ✓ | ✓ | |
--auto-fork |
Spawn a new maintenance container if necessary (default behavior). | ✓ | ✓ | |
--fork |
Forcefully spawn a new maintenance container. | ✓ | ✓ | |
--no-fork |
Suppress the automatic spawning of a new maintenance container. | ✓ | ✓ | |
--no-recurse |
Do not recurse (default behavior). | ✓ | ✓ | |
--recurse |
Recursively search for stacks in subdirectories. | ✓ | ✓ | |
--recurse-one |
Search for stacks in the first level of subdirectories. | ✓ | ✓ | |
$DEBUG |
If set, enables verbose logging and debug checkpoints. | ✓ | ✓ | |
$MAINTENANCE_LOG |
If set, enables logging to file and specifies the path to use. | ✓ | ✓ | |
$MAINTENANCE_LOG_ANSI |
If set, enables logging to file (incl. ANSI escapes) and specifies the path to use. | ✓ | ✓ | |
$ON_SCHEDULE |
If set, specifies the cron expression to use for scheduled maintenances. | ✓ | ||
$ON_START |
If set, triggers the maintenance when the container is started. | ✓ |
⚠ Options specified last override the behavior of preceding ones:
For instance,
--fork --no-fork
results in--no-fork
taking over.
Through these options, it's possible to customize the workflow:
Command-line | Description |
---|---|
* --run-pre <script>
|
Specify the pre-maintenance script(s). |
--pull |
Enable automatic image pull/update (default behavior). |
--no-pull |
Disable automatic image pull/update. |
--sideload |
Enable automatic image sideloading from a local archive (default behavior). |
--no-sideload |
Disable automatic image sideloading from a local archive. |
--build |
Enable automatic image re-building (default behavior).' |
--no-build |
Disable automatic image re-building.' |
* --run <script>
|
Specify the maintenance script(s). |
--up |
Enable automatic stack re-creation (default behavior).' |
--no-up |
Disable automatic stack re-creation.' |
* --run-post <script>
|
Specify the post-maintenance script(s). |
--clean |
Run docker system prune -af at the end' |
--clean-dangling |
Run docker system prune -f at the end' |
--no-clean |
Do not run prune operations at the end (default behavior).' |
* Options
--run
,--run-pre
,--run-post
can be specified multiple times.
Through these options it's possible to customize the way the underlying commands are invoked.
Environment variable | Description |
---|---|
$COMPOSE_BIN |
Command to run for docker-compose . |
$COMPOSE_FILE |
Name of the stack file (default: docker-compose.yml ). |
$DOCKER_BIN |
Command to run for docker . |
$DOCKER_SOCK |
Path to the docker socket. If unset, it's calculated from $DOCKER_HOST . |
$DOCKER_SIDELOAD |
Name of the sideload file (default: docker-sideload.tar ) |