mirror of
https://github.com/louislam/dockge.git
synced 2026-05-21 14:02:17 +00:00
Allow specifying which user the stack files should belong to (#83)
Co-authored-by: cmcooper1980 <31871143+cmcooper1980@users.noreply.github.com>
This commit is contained in:
42
README.md
42
README.md
@@ -81,9 +81,51 @@ curl "https://dockge.kuma.pet/compose.yaml?port=5001&stacksPath=/opt/stacks" --o
|
|||||||
- port=`5001`
|
- port=`5001`
|
||||||
- stacksPath=`/opt/stacks`
|
- stacksPath=`/opt/stacks`
|
||||||
|
|
||||||
|
ALSO, once compose is generated/downloaded, add the `PUID` and `PGID` section below to your compose `environment:` section to set stack ownership, otherwise default is `root`
|
||||||
|
|
||||||
|
```
|
||||||
|
# Both PUID and PGID must be set for it to do anything
|
||||||
|
- PUID=1000 # Set the stack file/dir ownership to this user
|
||||||
|
- PGID=1000 # Set the stack file/dir ownership to this group
|
||||||
|
```
|
||||||
|
|
||||||
Interactive compose.yaml generator is available on:
|
Interactive compose.yaml generator is available on:
|
||||||
https://dockge.kuma.pet
|
https://dockge.kuma.pet
|
||||||
|
|
||||||
|
##OR copy and paste your compose from the following:
|
||||||
|
|
||||||
|
If you want to store your stacks in another directory, you can change the `DOCKGE_STACKS_DIR` environment variable and volumes.
|
||||||
|
|
||||||
|
compose:
|
||||||
|
```
|
||||||
|
services:
|
||||||
|
dockge:
|
||||||
|
image: louislam/dockge:1
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
# Host Port:Container Port
|
||||||
|
- 5001:5001
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
- ./data:/app/data
|
||||||
|
|
||||||
|
# If you want to use private registries, you need to share the auth file with Dockge:
|
||||||
|
# - /root/.docker/:/root/.docker
|
||||||
|
|
||||||
|
# Stacks Directory
|
||||||
|
# Your stacks directory in the host (The paths inside container must be the same as the host)
|
||||||
|
# ⚠️ If you did it wrong, your data could end up be written into a wrong path.
|
||||||
|
# ✔️ CORRECT EXAMPLE: - /my-stacks:/my-stacks (Both paths match)
|
||||||
|
# ❌ WRONG EXAMPLE: - /docker:/my-stacks (Both paths do not match)
|
||||||
|
- /opt/stacks:/opt/stacks
|
||||||
|
environment:
|
||||||
|
# Tell Dockge where your stacks directory is
|
||||||
|
- DOCKGE_STACKS_DIR=/opt/stacks
|
||||||
|
# Both PUID and PGID must be set for it to do anything
|
||||||
|
- PUID=1000 # Set the stack file/dir ownership to this user
|
||||||
|
- PGID=1000 # Set the stack file/dir ownership to this group
|
||||||
|
```
|
||||||
|
|
||||||
## How to Update
|
## How to Update
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -195,14 +195,12 @@ export class Stack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write or overwrite the compose.yaml
|
// Write or overwrite the compose.yaml
|
||||||
await fsAsync.writeFile(path.join(dir, this._composeFileName), this.composeYAML);
|
fs.writeFileSync(path.join(dir, this._composeFileName), this.composeYAML);
|
||||||
|
if (process.env.PUID && process.env.PGID) {
|
||||||
const envPath = path.join(dir, ".env");
|
const uid = Number(process.env.PUID);
|
||||||
|
const gid = Number(process.env.PGID);
|
||||||
// Write or overwrite the .env
|
fs.lchownSync(dir, uid, gid);
|
||||||
// If .env is not existing and the composeENV is empty, we don't need to write it
|
fs.chownSync(path.join(dir, this._composeFileName), uid, gid);
|
||||||
if (await fileExists(envPath) || this.composeENV.trim() !== "") {
|
|
||||||
await fsAsync.writeFile(envPath, this.composeENV);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user