Description
In WSL2, the Minecraft server container fails to download and save plugins (e.g., WorldEdit) to the /data/plugins/ directory. The following error appears in the container logs:
java.nio.file.AccessDeniedException: /data/plugins/worldedit-bukkit-7.3.0.jar
This issue occurs when the local plugins directory has restrictive permissions, preventing the container from writing files.
Root Cause
-
Permissions Issue:
- The local
./plugins directory was owned by root with restrictive permissions (drwxr-xr-x).
- The container process, running as a non-root user, could not write to the directory.
-
File System Binding:
- The
./plugins directory is mounted to /data/plugins in the container using docker-compose.yml.
- The container requires write permissions on the mounted directory to save downloaded plugins.
Steps to Reproduce
- Create a
plugins directory locally:
- Mount the directory in docker-compose.yml:
volumes:
- ./plugins:/data/plugins
- Start the Minecraft server container:
docker-compose up
- Observe the container logs showing a
java.nio.file.AccessDeniedException when attempting to download plugins:
docker logs -f <container-id>
Solution
Update Directory Permissions
- Change ownership of the local plugins directory:
sudo chown -R $(whoami):$(whoami) plugins
- Ensure the directory is writable:
chmod -R 777 plugins
Restart the Server
- Stop the Minecraft server container:
docker-compose down
- Restart the server:
docker-compose up
Verify Plugin Installation
- Check the container logs to confirm the plugin downloads successfully:
docker logs -f <container-id>
- Verify the plugin exists in the plugins directory:
ls ./plugins
Key Findings
- The plugins directory must have appropriate write permissions (e.g., 777) to allow the container to write files.
- Containers running as non-root users will fail to write to directories with restrictive permissions (e.g.,
drwxr-xr-x owned by root).
Recommended Fix
Update Documentation
- Ensure local directories used as Docker volumes (e.g.,
./plugins/) are writable.
- Provide an example command to set appropriate permissions:
chmod -R 777 plugins
Description
In WSL2, the Minecraft server container fails to download and save plugins (e.g., WorldEdit) to the
/data/plugins/directory. The following error appears in the container logs:java.nio.file.AccessDeniedException: /data/plugins/worldedit-bukkit-7.3.0.jarThis issue occurs when the local
pluginsdirectory has restrictive permissions, preventing the container from writing files.Root Cause
Permissions Issue:
./pluginsdirectory was owned byrootwith restrictive permissions (drwxr-xr-x).File System Binding:
./pluginsdirectory is mounted to/data/pluginsin the container usingdocker-compose.yml.Steps to Reproduce
pluginsdirectory locally:docker-compose upjava.nio.file.AccessDeniedExceptionwhen attempting to download plugins:docker logs -f <container-id>Solution
Update Directory Permissions
sudo chown -R $(whoami):$(whoami) pluginschmod -R 777 pluginsRestart the Server
docker-compose downdocker-compose upVerify Plugin Installation
docker logs -f <container-id>ls ./pluginsKey Findings
drwxr-xr-xowned by root).Recommended Fix
Update Documentation
./plugins/) are writable.chmod -R 777 plugins