Skip to content

Commit 53c3162

Browse files
committed
Clarify Readme on bind volumes
Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com>
1 parent 178f8b6 commit 53c3162

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,36 @@ If you want to use named volumes for all of these, it would look like this:
8787
```console
8888
$ docker run -d \
8989
-v nextcloud:/var/www/html \
90-
-v apps:/var/www/html/custom_apps \
90+
-v custom_apps:/var/www/html/custom_apps \
9191
-v config:/var/www/html/config \
9292
-v data:/var/www/html/data \
9393
-v theme:/var/www/html/themes/<YOUR_CUSTOM_THEME> \
9494
nextcloud
9595
```
9696

97+
If you'd prefer to use bind mounts instead of named volumes, for instance, when working with different device or network mounts for user data files and configuration:
98+
```console
99+
$ docker run -d \
100+
-v $(pwd)/nextcloud:/var/www/html \
101+
-v $(pwd)/custom_apps:/var/www/html/custom_apps \
102+
-v $(pwd)/config:/var/www/html/config \
103+
-v $(pwd)/data:/var/www/html/data \
104+
-v $(pwd)/theme:/var/www/html/themes/<YOUR_CUSTOM_THEME> \
105+
nextcloud
106+
```
107+
108+
Here’s the same example using Docker's more detailed `--mount`. Note that with `-v` or `--volume`, the specified folders are created automatically if they don't exist. However, when using `--mount` for bind mounts, the directories must already exist on the host, or Docker will return an error.
109+
```console
110+
$ docker run -d \
111+
--mount type=bind,source=$(pwd)/nextcloud,target=/var/www/html \
112+
--mount type=bind,source=$(pwd)/custom_apps,target=/var/www/html/custom_apps \
113+
--mount type=bind,source=$(pwd)/config,target=/var/www/html/config \
114+
--mount type=bind,source=$(pwd)/data,target=/var/www/html/data \
115+
--mount type=bind,source=$(pwd)/theme,target=/var/www/html/themes/<YOUR_CUSTOM_THEME> \
116+
nextcloud
117+
```
118+
The examples above use the current directory for bind mounts. If this isn't suitable, you can modify the paths by using either a relative or absolute path. Additionally, do not mix the `apps` and `custom_apps` folders. These folders contain different sets of apps, and mixing them will result in a broken installation. While upgrades\recovery may sometimes still be possible, this configuration is likely to cause issues.
119+
97120
### Custom volumes
98121

99122
If mounting additional volumes under `/var/www/html`, you should consider:

0 commit comments

Comments
 (0)