mirror of
				https://github.com/offen/docker-volume-backup.git
				synced 2025-10-31 01:15:59 +08:00 
			
		
		
		
	docs: Update the custom commands documentation (#288)
Include requirement for docker socket and the need to use EXEC_LABEL if you are running multiple copies
This commit is contained in:
		
							parent
							
								
									e8ac4e1da6
								
							
						
					
					
						commit
						d0d8e5b076
					
				
					 2 changed files with 12 additions and 4 deletions
				
			
		|  | @ -16,6 +16,10 @@ Such commands are defined by specifying the command in a `docker-volume-backup.[ | ||||||
| - `copy` (the tar archive is copied to all configured storages) | - `copy` (the tar archive is copied to all configured storages) | ||||||
| - `prune` (existing backups are pruned based on the defined ruleset - optional) | - `prune` (existing backups are pruned based on the defined ruleset - optional) | ||||||
| 
 | 
 | ||||||
|  | {: .note } | ||||||
|  | So that the `docker-volume-backup` container can access the labels on other containers, it is necessary that the docker socket is mounted into | ||||||
|  | the `docker-volume-backup` container as shown in the Quickstart example. | ||||||
|  | 
 | ||||||
| Taking a database dump using `mysqldump` would look like this: | Taking a database dump using `mysqldump` would look like this: | ||||||
| 
 | 
 | ||||||
| ```yml | ```yml | ||||||
|  | @ -38,7 +42,9 @@ volumes: | ||||||
| Due to Docker limitations, you currently cannot use any kind of redirection in these commands unless you pass the command to `/bin/sh -c` or similar. | Due to Docker limitations, you currently cannot use any kind of redirection in these commands unless you pass the command to `/bin/sh -c` or similar. | ||||||
| I.e. instead of using `echo "ok" > ok.txt` you will need to use `/bin/sh -c 'echo "ok" > ok.txt'`. | I.e. instead of using `echo "ok" > ok.txt` you will need to use `/bin/sh -c 'echo "ok" > ok.txt'`. | ||||||
| 
 | 
 | ||||||
| If you need fine grained control about which container's commands are run, you can use the `EXEC_LABEL` configuration on your `docker-volume-backup` container: | If you have more than one `docker-volume-backup` container (possibly across several docker-compose environments) to backup or you are using | ||||||
|  | multiple backup schedules, you will need to use `EXEC_LABEL` in the configuration and a `docker-volume-backup.exec-label` label on each | ||||||
|  | container using custom commands to ensure that the commands are only run by the correct `docker-volume-backup` instance. | ||||||
| 
 | 
 | ||||||
| ```yml | ```yml | ||||||
| version: '3' | version: '3' | ||||||
|  |  | ||||||
|  | @ -57,9 +57,11 @@ services: | ||||||
|     volumes: |     volumes: | ||||||
|       - data:/backup/my-app-backup:ro |       - data:/backup/my-app-backup:ro | ||||||
|       # Mounting the Docker socket allows the script to stop and restart |       # Mounting the Docker socket allows the script to stop and restart | ||||||
|       # the container during backup. You can omit this if you don't want |       # the container during backup and to access the container labels to | ||||||
|       # to stop the container. In case you need to proxy the socket, you can |       # specify custom commands. You can omit this if you don't want to | ||||||
|       # also provide a location by setting `DOCKER_HOST` in the container |       # stop the container or run custom commands. In case you need to | ||||||
|  |       # proxy the socket, you can also provide a location by setting | ||||||
|  |       # `DOCKER_HOST` in the container | ||||||
|       - /var/run/docker.sock:/var/run/docker.sock:ro |       - /var/run/docker.sock:/var/run/docker.sock:ro | ||||||
|       # If you mount a local directory or volume to `/archive` a local |       # If you mount a local directory or volume to `/archive` a local | ||||||
|       # copy of the backup will be stored there. You can override the |       # copy of the backup will be stored there. You can override the | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue