From 0cf8b9da1a05805d419e4db6ff3f692b30414a7d Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Thu, 7 Aug 2025 12:37:00 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(minio)=20fix=20user=20permission?= =?UTF-8?q?=20error=20with=20Minio=20and=20Windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With Minio Docker and Windows, the user ID needs to be set to `0:0` to avoid permission issues. This change ensures that the Minio container runs with root privileges on Windows, which is necessary for proper file access and management. --- CHANGELOG.md | 5 ++--- Makefile | 10 ++++++--- bin/_config.sh | 4 ++++ docs/troubleshoot.md | 49 -------------------------------------------- 4 files changed, 13 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b3e4ed0..a21793b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to ### Fixed - 🐛(makefile) Windows compatibility fix for Docker volume mounting #1264 +- 🐛(minio) fix user permission error with Minio and Windows #1264 ## [3.5.0] - 2025-07-31 @@ -41,9 +42,7 @@ and this project adheres to - 🔧(project) change env.d system by using local files #1200 - ⚡️(frontend) improve tree stability #1207 - ⚡️(frontend) improve accessibility #1232 -- 🛂(frontend) block drag n drop when not desktop -#1239 - +- 🛂(frontend) block drag n drop when not desktop #1239 ### Fixed diff --git a/Makefile b/Makefile index 2e2d685a..20ecdfae 100644 --- a/Makefile +++ b/Makefile @@ -35,9 +35,13 @@ DB_PORT = 5432 # -- Docker # Get the current user ID to use for docker run and docker exec commands -DOCKER_UID = $(shell id -u) -DOCKER_GID = $(shell id -g) -DOCKER_USER = $(DOCKER_UID):$(DOCKER_GID) +ifeq ($(OS),Windows_NT) +DOCKER_USER := 0:0 # run containers as root on Windows +else +DOCKER_UID := $(shell id -u) +DOCKER_GID := $(shell id -g) +DOCKER_USER := $(DOCKER_UID):$(DOCKER_GID) +endif COMPOSE = DOCKER_USER=$(DOCKER_USER) docker compose COMPOSE_E2E = DOCKER_USER=$(DOCKER_USER) docker compose -f compose.yml -f compose-e2e.yml COMPOSE_EXEC = $(COMPOSE) exec diff --git a/bin/_config.sh b/bin/_config.sh index 7df06841..b317352f 100644 --- a/bin/_config.sh +++ b/bin/_config.sh @@ -38,6 +38,10 @@ function _set_user() { # options: docker compose command options # ARGS : docker compose command arguments function _docker_compose() { + # Set DOCKER_USER for Windows compatibility with MinIO + if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" || -n "${WSL_DISTRO_NAME:-}" ]]; then + export DOCKER_USER="0:0" + fi echo "🐳(compose) file: '${COMPOSE_FILE}'" docker compose \ diff --git a/docs/troubleshoot.md b/docs/troubleshoot.md index 1e480d2b..cacc14b0 100644 --- a/docs/troubleshoot.md +++ b/docs/troubleshoot.md @@ -83,55 +83,6 @@ If you already have CRLF line endings in your local repository, the **best appro git commit -m "✏️(project) Fix line endings to LF" ``` -## Minio Permission Issues on Windows - -### Problem Description - -On Windows, you may encounter permission-related errors when running Minio in development mode with Docker Compose. This typically happens because: - -- **Windows file permissions** don't map well to Unix-style user IDs used in Docker containers -- **Docker Desktop** may have issues with user mapping when using the `DOCKER_USER` environment variable -- **Minio container** fails to start or access volumes due to permission conflicts - -### Common Symptoms - -- Minio container fails to start with permission denied errors -- Error messages related to file system permissions in Minio logs -- Unable to create or access buckets in the development environment -- Docker Compose showing Minio service as unhealthy or exited - -### Solution for Windows Users - -If you encounter Minio permission issues on Windows, you can temporarily disable user mapping for the Minio service: - -1. **Open the `compose.yml` file** - -2. **Comment out the user directive** in the `minio` service section: - ```yaml - minio: - # user: ${DOCKER_USER:-1000} # Comment this line on Windows if permission issues occur - image: minio/minio - environment: - - MINIO_ROOT_USER=impress - - MINIO_ROOT_PASSWORD=password - # ... rest of the configuration - ``` - -3. **Restart the services**: - ```bash - make run - ``` - -### Why This Works - -- Commenting out the `user` directive allows the Minio container to run with its default user -- This bypasses Windows-specific permission mapping issues -- The container will have the necessary permissions to access and manage the mounted volumes - -### Note - -This is a **development-only workaround**. In production environments, proper user mapping and security considerations should be maintained according to your deployment requirements. - ## Frontend File Watching Issues on Windows ### Problem Description