Skip to content

Commit 0193268

Browse files
authored
docs: document data loss risks and volume management best practices (#288)
1 parent c837c0a commit 0193268

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

docs/user-guide/src/directory-layout-and-volumes.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,22 @@ The directory structure is as follows:
6767
a custom OCI image based on this one.
6868
This hybrid approach offers both flexibility and reproducibility.
6969

70-
!!! info "💾 Anonymous Volumes"
70+
## 💾 Anonymous Volumes
7171

72-
If you don’t specify volume mounts for `/data/worlds` or `/data/plugins`, the image will automatically create anonymous volumes for them.
73-
This ensures your data persists across container restarts and can improve container performance.
74-
However, these volumes won’t be easily accessible or manageable from outside the container.
72+
If you don’t specify volume mounts for `/data/worlds` or `/data/plugins`, the image will automatically create anonymous volumes for them.
73+
This ensures your data persists across container restarts and can improve container performance.
74+
However, these volumes won’t be easily accessible or manageable from outside the container.
75+
76+
!!! danger "⚠️ Risk of Data Loss"
77+
78+
Running `docker run --rm ...` will **automatically remove the container and any anonymous volumes** it created.
79+
This can lead to **permanent data loss**, especially if important directories like `/data/worlds` or `/data/plugins` were stored in those volumes.
80+
81+
To avoid this, it's essential to follow proper volume management practices — **see best practices below**.
82+
83+
## ✅ Best Practices
84+
85+
- **Explicitly mount `/data/worlds` and `/data/plugins`** using named volumes or bind mounts to ensure data persistence.
86+
- Avoid relying on anonymous volumes when using `--rm`, as they are deleted along with the container.
87+
- **Use a custom OCI image** based on this one to include static files such as default configurations or plugin JARs, while keeping dynamic data in volumes.
88+
- **Implement regular backups** of your mounted data directories to safeguard against accidental loss or corruption.

0 commit comments

Comments
 (0)