docker_db_admin
Back up a database container by writing a dump inside it, or restore a database from a dump already there, requiring confirmation before overwriting.
Instructions
backup takes a dump of a database container, restore fills the database from one. The answer names the file, its size and whether it was read back: a call that says done without naming a file of known size says nothing. Restore overwrites what is there and is refused without confirm — take a backup here first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | Path of the dump inside the container. Required by action restore. For backup the default is a name with the time of day under /backups, which must be a directory the container already has. | |
| clean | No | Drop what is already there before writing, for action restore. Archive backups only (.dump, .backup) for PostgreSQL. Default: false. | |
| action | Yes | backup writes a dump inside the container and reads it back to say how large it is. restore fills the database from a dump that is already there, overwriting what it holds. | |
| format | No | Shape of the dump, for action backup. Default: the one this engine dumps in — an archive for PostgreSQL, plain SQL for MySQL, its own archive for MongoDB. A format the client has no flag for is refused. | |
| tables | No | Only these tables, for action backup. Default: the whole database. MongoDB takes one collection at a time. | |
| confirm | No | Written out as "# CONFIRMED-DESTRUCTIVE", this allows one restore to overwrite the database. Anything else leaves the refusal standing. | |
| profile | No | Which Docker host, by profile name. Default: the profile marked as default. | |
| project | No | Which compose project. Default: the project of the working directory. A name matching nothing is an error, not a fall back to every container on the host. | |
| service | Yes | Service name as written in the compose file. | |
| compress | No | Compress the dump, for action backup. Only where the client compresses by itself. Default: true. | |
| dataOnly | No | Write the rows and leave the schema alone, for action restore. Default: false. | |
| database | No | Which database to fill, for action restore. Default: the one the container was started with. | |
| schemaOnly | No | Write the schema and none of the rows, for action restore. Default: false. | |
| compose_path | No | Where the compose file is: the file itself, or the directory holding it. Needed only when no container of the host carries the project label — a project that was never brought up there. A directory holding several compose files is refused with their names rather than guessed through. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | ||
| bytes | No | ||
| action | No | ||
| engine | No | ||
| legend | No | What the words in this answer mean. A key names the field before the value — "state=running", "containers[].health=unhealthy" — and only the values this answer used are listed. | |
| reason | No | ||
| message | No | ||
| project | No | ||
| service | No | ||
| verified | No | ||
| confirmed | No | ||
| restarted | No |