This Docker Compose configuration sets up Label Studio with PostgreSQL as the backend database. Label Studio is an open-source data labeling tool that supports various data types. PostgreSQL is used as the database to store project and annotation data.
- Docker installed
- Docker Compose installed
This setup consists of two main services:
- PostgreSQL (version 14.5) as the database.
- Label Studio as the front-end labeling interface.
-
PostgreSQL
- Exposed on port
5437
. - Stores data in a Docker volume
postgres_data
to persist the database across container restarts. - Healthcheck ensures the database is ready before Label Studio starts.
- Exposed on port
-
Label Studio
- Exposed on port
8090
. - Data for Label Studio is stored in a Docker volume
labelstudio_data
to persist user data. - It automatically migrates the database on startup.
- Optionally, you can set a secure access token for Label Studio by uncommenting the
LABEL_STUDIO_ACCESS_TOKEN
environment variable.
- Exposed on port
-
Clone the repository or copy the
docker-compose.yml
file to your project. -
Ensure Docker and Docker Compose are installed and running.
-
Run the following command to start the services:
docker compose up -d
-
After all services are up, access Label Studio in your browser at:
http://localhost:8090
.
You can adjust the environment variables for both services in the docker-compose.yml
file:
-
PostgreSQL
POSTGRES_DB
: The database name (default:labelstudio
).POSTGRES_USER
: The database user (default:labelstudio
).POSTGRES_PASSWORD
: The password for the database user (default:labelstudio_password
).
-
Label Studio
POSTGRE_HOST
: The hostname for PostgreSQL (default:postgres
).POSTGRE_PORT
: The PostgreSQL port (default:5432
).POSTGRE_NAME
: The PostgreSQL database name (default:labelstudio
).POSTGRE_USER
: The PostgreSQL user (default:labelstudio
).POSTGRE_PASSWORD
: The PostgreSQL user password (default:labelstudio_password
).- Uncomment the
LABEL_STUDIO_ACCESS_TOKEN
line to secure access with a token.
This setup uses Docker volumes to persist data:
postgres_data
: Stores PostgreSQL data.labelstudio_data
: Stores Label Studio project and annotation data.
To stop the running services, run:
docker compose down