HumanSignal / HumanSignal/label-studio

Local File Serving Not Working in Docker Container Despite Correct Environment Variables

Open
#6,087 4 comments 0 reactions 0 assignees View on GitHub
community:needs-information community:reviewed
Dominant language
TypeScript
Stars
28.3k
Forks
3.7k
Avg merge
14h
Merged PRs (30d)
15

Description

**Describe the bug**
I'm running Label Studio inside a Docker container using docker-compose. I've set up environment variables to access data from local files (linked to a volume). The files exist when checking within the container, but I cannot access them through URLs from the browser or within the container.

**To Reproduce**
Steps to reproduce the behavior:
1. Create a docker-compose.yml with the following Label Studio service configuration:

```yaml
labelstudio:
image: heartexlabs/label-studio:latest
ports:
- "4999:8000"
depends_on:
- database
environment:
- LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true
- LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/label-studio/data
- LABEL_STUDIO_BASE_DATA_DIR=/label-studio/data/
- LABEL_STUDIO_CORS_ORIGIN=*
- LOG_LEVEL=DEBUG
volumes:
- label_studio_mydata:/label-studio/data:rw
- documents_dataset:/label-studio/data/raw_datasets/documents_dataset:rw
command: label-studio-uwsgi
```

1. Start the Label Studio container.

2. Inside the container, create a test file:

echo "this is fake image" > /label-studio/data/raw_datasets/documents_dataset/document1/document1_Page_01.jpg
2.Attempt to access the file via browser:
http://localhost:4999/data/local-files/?d=raw_datasets/documents_dataset/document1/document1_Page_01.jpg
2.Attempt to access the file from within the container:
Copy curl -v 'http://localhost:8000/data/local-files/?d=raw_datasets/documents_dataset/document1/document1_Page_01.jpg'

**Expected behavior**
The file should be accessible via the provided URLs.
Actual behavior

Browser access fails
Curl command from within the container fails to retrieve the file

**Environment information:**

Label Studio Version: Label Studio version: 1.12.1

**Additional context**

Environment variables are correctly set within the container:
LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true
LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/label-studio/data
LABEL_STUDIO_BASE_DATA_DIR=/label-studio/data/

The files are present and accessible within the container when checked directly.
Unable to find Label Studio configuration file (/label-studio/data/label_studio_config.json) within the container.
Unable to locate or access Label Studio log files within the container.

**Attempted troubleshooting:**

Verified file permissions within the container
Checked environment variables
Attempted to access a simple text file using curl within the container (failed)

Any assistance in resolving this issue would be greatly appreciated.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.