wiki:use_hetzner_storage_box_docker_volume
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
wiki:use_hetzner_storage_box_docker_volume [2023/03/09 10:15] – created antisa | wiki:use_hetzner_storage_box_docker_volume [2023/06/19 13:02] (current) – add info about host share mount antisa | ||
---|---|---|---|
Line 2: | Line 2: | ||
====== Use Hetzner storage box as docker volume ====== | ====== Use Hetzner storage box as docker volume ====== | ||
+ | First create the directory on the share e.g. // | ||
+ | mkdir / | ||
+ | |||
+ | |||
Create volume with cifs driver | Create volume with cifs driver | ||
Line 10: | Line 14: | ||
--opt device=// | --opt device=// | ||
--opt o=addr=uxxxxxx.your-storagebox.de, | --opt o=addr=uxxxxxx.your-storagebox.de, | ||
- | --name | + | --name |
</ | </ | ||
+ | |||
+ | This is enough, you don't need to mount the share on host as well. | ||
+ | |||
+ | |||
+ | <WRAP center round tip 60%> | ||
+ | If the app running in container is running and trying to write as a different user than root, you will need to adjust the permissions in above command that creates volumes to '' | ||
+ | </ | ||
+ | |||
Ansible playbook task example: | Ansible playbook task example: | ||
Line 20: | Line 32: | ||
- name: Create docker volume on shared storagebox | - name: Create docker volume on shared storagebox | ||
docker_volume: | docker_volume: | ||
- | name: docker_volume | + | name: cifs_volume |
driver_options: | driver_options: | ||
type: cifs | type: cifs | ||
Line 35: | Line 47: | ||
docker run -d \ | docker run -d \ | ||
--name=nginxtest \ | --name=nginxtest \ | ||
- | -v cif-volume:/ | + | -v cifs_volume:/ |
nginx: | nginx: | ||
</ | </ | ||
+ | |||
+ | |||
====== Tested on ====== | ====== Tested on ====== | ||
* Docker 23.0.1 | * Docker 23.0.1 |
wiki/use_hetzner_storage_box_docker_volume.1678356912.txt.gz · Last modified: 2023/03/09 10:15 by antisa