Label Studio + PostgreSQL + Redis
Data labeling platform with enterprise features for ML training data.
Overview
Label Studio is an open-source data labeling platform developed by Heartex that enables teams to create high-quality training datasets for machine learning projects. Originally launched in 2019, Label Studio has become a leading solution for annotating text, images, audio, video, and time series data, supporting over 20 different ML tasks from text classification to object detection. The platform provides a web-based interface where teams can configure custom labeling templates, manage annotator workflows, and export labeled data in formats compatible with popular ML frameworks like TensorFlow, PyTorch, and scikit-learn.
This enterprise-grade stack combines Label Studio with PostgreSQL for robust data persistence and Redis for high-performance caching and session management. PostgreSQL stores all project configurations, user data, annotations, and metadata with ACID compliance, ensuring data integrity even during concurrent labeling sessions. Redis accelerates the platform by caching frequently accessed data, managing real-time collaboration features, and handling background task queues for data import/export operations. NGINX serves as the reverse proxy, efficiently delivering static assets like images and documents while load balancing requests to the Label Studio application server.
Data science teams, ML engineers, and organizations building custom AI models should deploy this stack when they need a scalable, production-ready annotation platform. Unlike basic labeling tools, this configuration supports enterprise features like user authentication, project-based access control, annotation quality metrics, and API integrations. The PostgreSQL backend enables complex queries for annotation analytics and audit trails, while Redis ensures responsive performance even with large datasets and multiple concurrent annotators working on the same projects.
Key Features
- Multi-format data support with configurable labeling interfaces for text, images, audio, video, HTML, and time series data
- PostgreSQL-backed project management with user roles, annotation versioning, and detailed audit trails
- Redis-powered real-time collaboration enabling multiple annotators to work simultaneously without conflicts
- NGINX-optimized file serving for large media assets with efficient caching and compression
- Advanced annotation quality controls including inter-annotator agreement scoring and review workflows
- API-first architecture with RESTful endpoints for automated data import, export, and integration with ML pipelines
- Flexible labeling templates supporting custom taxonomies, multi-class classification, named entity recognition, and bounding box annotations
- Enterprise authentication integration with LDAP, SSO, and role-based access control for secure multi-team environments
Common Use Cases
- 1Computer vision teams annotating large image datasets for object detection, semantic segmentation, and facial recognition models
- 2NLP projects requiring text classification, named entity recognition, sentiment analysis, and document categorization
- 3Healthcare organizations labeling medical images, patient records, and clinical trial data with strict compliance requirements
- 4Autonomous vehicle companies creating training datasets for road sign detection, lane marking, and obstacle identification
- 5Content moderation teams at social media platforms labeling text posts, images, and videos for harmful content detection
- 6Research institutions conducting longitudinal studies requiring consistent data annotation across multiple researchers
- 7E-commerce companies building recommendation systems by labeling product images, descriptions, and customer review sentiment
Prerequisites
- Minimum 2GB RAM (4GB+ recommended) to support PostgreSQL database operations and Label Studio's web interface
- Docker Engine 20.10+ and Docker Compose 2.0+ for container orchestration and volume management
- Available ports 80, 8080, 5432, and 6379 for NGINX, Label Studio, PostgreSQL, and Redis respectively
- Understanding of data annotation workflows and familiarity with ML training data requirements
- Basic knowledge of PostgreSQL administration for database maintenance and backup procedures
- Storage capacity planning based on dataset size - PostgreSQL data, Redis memory, and Label Studio file storage requirements
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 label-studio: 3 image: heartexlabs/label-studio:latest4 environment: 5 - DJANGO_DB=default6 - POSTGRE_HOST=postgres7 - POSTGRE_PORT=54328 - POSTGRE_NAME=labelstudio9 - POSTGRE_USER=${POSTGRES_USER}10 - POSTGRE_PASSWORD=${POSTGRES_PASSWORD}11 - REDIS_HOST=redis12 - REDIS_PORT=637913 - LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true14 - LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/label-studio/files15 volumes: 16 - ls-data:/label-studio/data17 - ls-files:/label-studio/files18 ports: 19 - "8080:8080"20 depends_on: 21 - postgres22 - redis23 networks: 24 - labelstudio-network25 restart: unless-stopped2627 postgres: 28 image: postgres:1529 environment: 30 - POSTGRES_USER=${POSTGRES_USER}31 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}32 - POSTGRES_DB=labelstudio33 volumes: 34 - postgres-data:/var/lib/postgresql/data35 networks: 36 - labelstudio-network37 restart: unless-stopped3839 redis: 40 image: redis:alpine41 volumes: 42 - redis-data:/data43 networks: 44 - labelstudio-network45 restart: unless-stopped4647 nginx: 48 image: nginx:alpine49 volumes: 50 - ./nginx.conf:/etc/nginx/nginx.conf:ro51 - ls-files:/files:ro52 ports: 53 - "80:80"54 depends_on: 55 - label-studio56 networks: 57 - labelstudio-network58 restart: unless-stopped5960volumes: 61 ls-data: 62 ls-files: 63 postgres-data: 64 redis-data: 6566networks: 67 labelstudio-network: 68 driver: bridge.env Template
.env
1# Label Studio2POSTGRES_USER=labelstudio3POSTGRES_PASSWORD=secure_postgres_password45# Create superuser on first run:6# docker exec -it label-studio label-studio user createUsage Notes
- 1Label Studio at http://localhost:8080
- 2Create first user via signup
- 3Import data from local files or cloud
- 4Support for text, image, audio, video
- 5Export in multiple formats
Individual Services(4 services)
Copy individual services to mix and match with your existing compose files.
label-studio
label-studio:
image: heartexlabs/label-studio:latest
environment:
- DJANGO_DB=default
- POSTGRE_HOST=postgres
- POSTGRE_PORT=5432
- POSTGRE_NAME=labelstudio
- POSTGRE_USER=${POSTGRES_USER}
- POSTGRE_PASSWORD=${POSTGRES_PASSWORD}
- REDIS_HOST=redis
- REDIS_PORT=6379
- LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true
- LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/label-studio/files
volumes:
- ls-data:/label-studio/data
- ls-files:/label-studio/files
ports:
- "8080:8080"
depends_on:
- postgres
- redis
networks:
- labelstudio-network
restart: unless-stopped
postgres
postgres:
image: postgres:15
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=labelstudio
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- labelstudio-network
restart: unless-stopped
redis
redis:
image: redis:alpine
volumes:
- redis-data:/data
networks:
- labelstudio-network
restart: unless-stopped
nginx
nginx:
image: nginx:alpine
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ls-files:/files:ro
ports:
- "80:80"
depends_on:
- label-studio
networks:
- labelstudio-network
restart: unless-stopped
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 label-studio:5 image: heartexlabs/label-studio:latest6 environment:7 - DJANGO_DB=default8 - POSTGRE_HOST=postgres9 - POSTGRE_PORT=543210 - POSTGRE_NAME=labelstudio11 - POSTGRE_USER=${POSTGRES_USER}12 - POSTGRE_PASSWORD=${POSTGRES_PASSWORD}13 - REDIS_HOST=redis14 - REDIS_PORT=637915 - LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED=true16 - LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT=/label-studio/files17 volumes:18 - ls-data:/label-studio/data19 - ls-files:/label-studio/files20 ports:21 - "8080:8080"22 depends_on:23 - postgres24 - redis25 networks:26 - labelstudio-network27 restart: unless-stopped2829 postgres:30 image: postgres:1531 environment:32 - POSTGRES_USER=${POSTGRES_USER}33 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}34 - POSTGRES_DB=labelstudio35 volumes:36 - postgres-data:/var/lib/postgresql/data37 networks:38 - labelstudio-network39 restart: unless-stopped4041 redis:42 image: redis:alpine43 volumes:44 - redis-data:/data45 networks:46 - labelstudio-network47 restart: unless-stopped4849 nginx:50 image: nginx:alpine51 volumes:52 - ./nginx.conf:/etc/nginx/nginx.conf:ro53 - ls-files:/files:ro54 ports:55 - "80:80"56 depends_on:57 - label-studio58 networks:59 - labelstudio-network60 restart: unless-stopped6162volumes:63 ls-data:64 ls-files:65 postgres-data:66 redis-data:6768networks:69 labelstudio-network:70 driver: bridge71EOF7273# 2. Create the .env file74cat > .env << 'EOF'75# Label Studio76POSTGRES_USER=labelstudio77POSTGRES_PASSWORD=secure_postgres_password7879# Create superuser on first run:80# docker exec -it label-studio label-studio user create81EOF8283# 3. Start the services84docker compose up -d8586# 4. View logs87docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/label-studio-enterprise/run | bashTroubleshooting
- Label Studio shows 'Database connection failed': Check POSTGRES_USER and POSTGRES_PASSWORD environment variables match between services
- Redis connection timeout errors: Increase Redis memory limit or check if Redis container has sufficient RAM allocation
- File upload failures with large media assets: Configure NGINX client_max_body_size and Label Studio's LABEL_STUDIO_LOCAL_FILES_SERVING_ENABLED setting
- PostgreSQL 'too many connections' error: Adjust max_connections in PostgreSQL config or implement connection pooling in Label Studio
- Slow annotation interface loading: Verify Redis is properly connected and consider increasing Redis memory or using Redis persistence
- NGINX 502 Bad Gateway errors: Ensure Label Studio container is fully started before NGINX attempts to proxy requests
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
label-studiopostgresqlredisnginx
Tags
#label-studio#annotation#labeling#ml-data#training-data
Category
AI & Machine LearningAd Space
Shortcuts: C CopyF FavoriteD Download