Configuring Local File Serving for Label Studio on Docker (Windows)

Question:

I’ve updated the .env file with LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true and LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/label-studio/data , but the local file serving still isn’t working in my Docker setup on Windows. How can I resolve this?

Answer:

To properly enable local file serving with Label Studio on Docker in Windows, follow these steps:

  • Docker Volume Mapping: Confirm the Docker volume is correctly mapped from the host directory to the Docker container directory.

  • Environment Variables: Environment variables like LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED and LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT must be set. They should be declared in the Docker run command, not just the .env file, to ensure Docker recognizes them.

  • Path Specification: The LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT should be the container’s internal path as defined by Docker’s volume mapping.

You can start your Docker container using the following command:

docker run -it -p 8080:8080 \
  -v C:\path\to\your\data:/label-studio/data \
  --env LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true \
  --env LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/label-studio/data \
  heartexlabs/label-studio:latest

Remember to replace C:\path\to\your\data with your actual data directory on Windows. This setup ensures the environment variables take effect for the correct directory mapping inside the Docker container.