Skip to content

Commit ef0f1a2

Browse files
authored
adding info aubout docker user, security and UID/GID and version (#686)
* adding info aubout docker user, security and UID/GID and version * change url so docusaurus will work
1 parent 22f2da2 commit ef0f1a2

1 file changed

Lines changed: 63 additions & 23 deletions

File tree

docs/admin/getting-started/container/docker-compose/docker-compose-base.md

Lines changed: 63 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ draft: false
88

99
# OpenCloud with Docker Compose
1010

11-
Install a internet facing OpenCloud with SSL certification with Docker Compose.
11+
Install an internet-facing OpenCloud with SSL certification using Docker Compose.
1212

1313
This installation documentation is for Ubuntu and Debian systems. The software can also be installed on other Linux distributions, but the commands and package managers may differ.
1414

@@ -29,27 +29,44 @@ This installation documentation is for Ubuntu and Debian systems. The software c
2929
Log into your server via SSH:
3030

3131
```bash
32-
ssh root@YOUR.SERVER.IP
32+
ssh YOUR_ADMIN_USER@YOUR.SERVER.IP
3333
```
3434

35+
:::note
36+
Use a non-root user with `sudo` privileges. If you logged in as root, prepend `sudo` where appropriate or run the commands without `sudo`
37+
:::
38+
3539
## Install Docker
3640

3741
Update your system and install Docker.
3842

3943
First, perform an update and upgrade:
4044

4145
```bash
42-
apt update && apt upgrade -y
46+
sudo apt update && sudo apt upgrade -y
4347
```
4448

4549
Install Docker following the [official Docker guide](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository)
4650

4751
Once Docker is installed, enable and start the service:
4852

4953
```bash
50-
systemctl enable docker && systemctl start docker
54+
sudo systemctl enable docker && sudo systemctl start docker
5155
```
5256

57+
## Create a dedicated user to run OpenCloud (recommended)
58+
59+
For security reasons, do not run the OpenCloud stack as `root`. Create a dedicated user (for example `opencloud`) and run the remaining steps as that user.
60+
61+
```bash
62+
sudo adduser opencloud
63+
sudo usermod -aG docker opencloud
64+
```
65+
66+
Log out and log back in (or start a new login shell), then continue as `opencloud`.
67+
68+
Docker can be managed as a non-root user (e.g. via the `docker` group). Be aware that access to the Docker daemon is effectively equivalent to root access on the host. Limit group membership and restrict access accordingly.
69+
5370
## Clone the OpenCloud Repository
5471

5572
Download the necessary configuration files:
@@ -90,13 +107,13 @@ nano .env
90107

91108
### Disable insecure mode
92109

93-
```bash
110+
```env
94111
# INSECURE=true
95112
```
96113

97114
### Set your domain names
98115

99-
```bash
116+
```env
100117
TRAEFIK_DOMAIN=traefik.YOUR.DOMAIN
101118
OC_DOMAIN=cloud.YOUR.DOMAIN
102119
COLLABORA_DOMAIN=collabora.YOUR.DOMAIN
@@ -105,27 +122,27 @@ WOPISERVER_DOMAIN=wopiserver.YOUR.DOMAIN
105122

106123
### Set your admin password
107124

108-
```bash
125+
```env
109126
INITIAL_ADMIN_PASSWORD=YourSecurePassword
110127
```
111128

112129
### Set your email for SSL certification
113130

114-
```bash
131+
```env
115132
TRAEFIK_ACME_MAIL=your@email.com
116133
```
117134

118135
### Use Let's Encrypt staging certificates (for testing)
119136

120-
```bash
137+
```env
121138
TRAEFIK_ACME_CASERVER=https://acme-staging-v02.api.letsencrypt.org/directory
122139
```
123140

124141
### Set your deployment options
125142

126-
For Example without Collabora:
143+
For example, without Collabora:
127144

128-
```bash
145+
```env
129146
COMPOSE_FILE=docker-compose.yml:traefik/opencloud.yml
130147
```
131148

@@ -140,7 +157,7 @@ This works fine for local development or quick evaluations — but is not suitab
140157

141158
#### Mount Persistent Volumes
142159

143-
In production, you should mount persistent local directories for configuration and data to ensure:
160+
For production setups, mount persistent host directories for configuration and data. This gives you:
144161

145162
- Data durability
146163
- Easier backups and recovery
@@ -153,24 +170,41 @@ OC_CONFIG_DIR=/your/local/path/opencloud/config
153170
OC_DATA_DIR=/your/local/path/opencloud/data
154171
```
155172

173+
### UID/GID and volume permissions (important)
174+
175+
OpenCloud containers run as `1000:1000` by default.
176+
If your host user uses different IDs, set `OC_CONTAINER_UID_GID` in `.env` so file ownership matches your host user:
177+
178+
```env
179+
OC_CONTAINER_UID_GID=1001:1001
180+
```
181+
182+
You can check your UID/GID with:
183+
184+
```bash
185+
id -u
186+
id -g
187+
```
188+
156189
:::tip Folder Permissions
157190

158-
Ensure these folders exist and are owned by user and group 1000:1000, which the Docker containers use by default:
191+
Create the folders and assign ownership to the UID/GID used by the container (default `1000:1000`, or your `OC_CONTAINER_UID_GID` value):
159192

160193
```bash
161194
sudo mkdir -p /your/local/path/opencloud/{config,data}
162-
sudo chown -R 1000:1000 /your/local/path/opencloud
195+
sudo chown -R $(id -u):$(id -g) /your/local/path/opencloud
163196
```
164197

165198
:::
166199

167-
If these variables are left unset, Docker will use internal volumes, which do not persist if the containers are removed — not recommended for real-world use.
200+
If `OC_CONFIG_DIR` and `OC_DATA_DIR` are not set, Docker uses internal volumes. Those are harder to manage for backups and are not recommended for production.
168201

169202
:::caution Security Warning
170203

171-
The user with UID 1000 on your host system will have full access to these mounted directories. This means that any local user account with this ID can read, modify, or delete OpenCloud config and data files.
204+
Any local account that matches the mapped UID/GID can access these mounted directories.
205+
In shared or multi-user environments, this can expose OpenCloud config and data files.
172206

173-
This can pose a security risk in shared or multi-user environments. Make sure to implement proper user and permission management and consider isolating access to these directories.
207+
Use strict host-level permission management and isolate access to these paths where possible.
174208

175209
:::
176210

@@ -180,9 +214,15 @@ To avoid accidentally updating to a version with breaking changes, you should sp
180214

181215
```env
182216
OC_DOCKER_IMAGE=opencloudeu/opencloud
183-
OC_DOCKER_TAG=2
217+
OC_DOCKER_TAG=4.0.3
184218
```
185219

220+
:::tip Keep the version up to date
221+
The documentation may not always reference the latest available release. Before deploying (and when updating), check the available tags on Docker Hub and adjust `OC_DOCKER_TAG` to the most recent stable version:
222+
223+
[Docker Hub – opencloudeu/opencloud tags](https://hub.docker.com/r/opencloudeu/opencloud/tags)
224+
:::
225+
186226
## Start OpenCloud
187227

188228
Launch OpenCloud using Docker Compose:
@@ -202,7 +242,7 @@ https://cloud.YOUR.DOMAIN
202242
```
203243

204244
You should see a security warning because the staging certificate is not fully trusted.
205-
Same should appear with the other domains you are using.
245+
The same warning should appear for the other domains you are using.
206246

207247
Example with Chrome browser:
208248

@@ -226,10 +266,10 @@ docker compose down
226266
### Remove old staging certificates
227267

228268
```bash
229-
rm -r certs
269+
rm -rf ./certs
230270
```
231271

232-
(If you changed volume names, adjust accordingly.)
272+
(Run this in the `opencloud-compose` directory. If you changed volume names, adjust accordingly.)
233273

234274
### Disable staging mode in `.env`
235275

@@ -239,7 +279,7 @@ nano .env
239279

240280
Comment the staging server:
241281

242-
```bash
282+
```env
243283
# TRAEFIK_ACME_CASERVER=https://acme-staging-v02.api.letsencrypt.org/directory
244284
```
245285

@@ -249,7 +289,7 @@ Comment the staging server:
249289
docker compose up -d
250290
```
251291

252-
Now, visiting `https://cloud.YOUR.DOMAIN` should show a secure connection with a valid SSL certificate.
292+
Now, visiting `https://cloud.YOUR.DOMAIN` should show a secure connection with a valid SSL certificate.
253293

254294
<img src={require("./../../img/docker-compose/status-secure.png").default} alt="Certificate Details" width="1920"/>
255295

0 commit comments

Comments
 (0)