Go Docker deployment
This guide documents the Go implementation of RAGFlow. Use docker/.env, docker/docker-compose.yml, Dockerfile, and docker/entrypoint.sh for a Go deployment.
The Go image runs the API, Admin, Ingestor, and Syncer modes from the single bin/ragflow_server binary. DeepDoc inference runs in-process. Select an official Go image tag documented in the corresponding release notes, or build the image locally as described below.
📗 Table of Contents
🐳 Docker Compose
- docker-compose.yml Starts the Go RAGFlow container together with the selected dependencies.
- docker-compose-base.yml
Defines the dependency services. The default Go profile uses Elasticsearch, MySQL, MinIO, Kvrocks, NATS, and ClickHouse. Other document engines and metadata databases are selected through
.env.
Note:
docker-compose-CN-oc9.ymlanddocker-compose-macos.ymlare not the Go deployment entry points. On Linux and macOS, usedocker-compose.yml; Apple Silicon runs the currentlinux/amd64Go image through Docker Desktop emulation.
Quick start
Run the Go release deployment from the repository checkout:
# Enter the Docker deployment directory.
cd ragflow/docker
# Check out the Go v1.0.0-rc1 release tag.
git checkout v1.0.0-rc1
# Start the Go services and their dependencies in the background.
docker compose -f docker-compose.yml up -d
If you use the default Elasticsearch document engine on Linux, set vm.max_map_count to at least 262144 on the Docker host:
sudo sysctl -w vm.max_map_count=262144
This change is temporary. To preserve it after a reboot, add vm.max_map_count=262144 to /etc/sysctl.conf. On Docker Desktop, apply the setting inside its Linux virtual machine as described in the Go image build guide.
The v1.0.0-rc1 tag and later release tags use the Go implementation. The entrypoint migrates the default MySQL metadata database first, then starts the Go Syncer, Admin server, API server, and Ingestor. Open http://localhost after the HTTP health check succeeds.
For local image builds, use the Go image build guide.
Verify the deployment with:
docker compose -f docker-compose.yml ps
docker logs --tail 100 ragflow-cpu
curl -f http://localhost/api/v1/system/healthz
If SVR_WEB_HTTP_PORT is not 80, append the configured port to the URL. In the RAGFlow open-source 1.0 release, DeepDoc layout analysis, OCR, and table recognition use CPU inference.
🐬 Docker environment variables
The .env file is the user-facing environment file for the Go deployment. Compose also loads shared defaults from .env for included dependency definitions. When a dependency setting exists in both files, keep the credentials and published ports consistent.
Metadata database
DB_TYPEThe business metadata database type. Defaults tomysql. Set it tooceanbasewhen connecting to OceanBase through its MySQL-compatible protocol.COMPOSE_PROFILESThe Docker Compose profiles to enable. By default it contains${DOC_ENGINE},${DEVICE},metadata-${METADATA_DB_PROFILE},ragflow-go,clickhouse.METADATA_DB_PROFILEDefaults tomysql, preserving the in-cluster MySQL service.
Elasticsearch
STACK_VERSIONThe version of Elasticsearch. Defaults to8.11.3ES_PORTThe port used to expose the Elasticsearch service to the host machine, allowing external access to the service running inside the Docker container. Defaults to1200.ELASTIC_PASSWORDThe password for Elasticsearch.
Kibana
KIBANA_PORTThe port used to expose the optional Kibana service to the host machine. Defaults to6601. Follow the enablement notes in.envbefore adding thekibanaprofile.
Resource management
MEM_LIMITThe maximum memory available to each Compose service that applies this limit. It is a per-container upper limit, not the minimum host memory, the total memory reserved by RAGFlow, or a guarantee that every container consumes this amount. The default is8073741824bytes, approximately7.52 GiB(8.07 GB).
MySQL
MYSQL_PASSWORDThe password for MySQL. Required only whenDB_TYPE=mysqlstarts the in-cluster MySQL metadata database.MYSQL_PORTThe port to connect to MySQL from RAGFlow container. Defaults to3306. Change this if you use an external MySQL.EXPOSE_MYSQL_PORTThe port used to expose the MySQL service to the host machine, allowing external access to the MySQL database running inside the Docker container. Defaults to3306.MYSQL_MAX_PACKETThe maximum MySQL communication packet size in bytes. Defaults to1073741824bytes (1 GiB). Keep the MySQL server'smax_allowed_packetsetting compatible when using an external database.
MinIO
MINIO_CONSOLE_PORTThe port used to expose the MinIO console interface to the host machine, allowing external access to the web-based console running inside the Docker container. Defaults to9001MINIO_PORTThe port used to expose the MinIO API service to the host machine, allowing external access to the MinIO object storage service running inside the Docker container. Defaults to9000.MINIO_USERThe username for MinIO.MINIO_PASSWORDThe password for MinIO.
Kvrocks
The Go services use Kvrocks as their Redis-compatible cache. NATS JetStream provides the message queue.
KVROCKS_HOSTThe hostname used by the Go services. Keep the defaultkvrocksfor the Compose deployment.KVROCKS_PORTThe host-published Kvrocks port. Defaults to6379.REDIS_PASSWORDThe password shared with the Kvrocks service.
NATS
The Go services use NATS JetStream for ingestion, synchronization, memory, and knowledge-compilation messages.
NATS_HOSTThe NATS hostname used inside the Compose network. Defaults tonats.NATS_PORTThe internal NATS client port. Defaults to4222.EXPOSE_NATS_PORTThe port published on the Docker host. Change this value to avoid a host-side port conflict; Go containers continue to useNATS_PORTinternally.
RAGFlow
SVR_HTTP_PORTThe target Go API port published by Compose. Defaults to9380; Nginx proxies normal web API requests to this service.ADMIN_SVR_HTTP_PORTThe target Go Admin port published by Compose. Defaults to9381.SVR_WEB_HTTP_PORT,SVR_WEB_HTTPS_PORTThe public Nginx ports. Defaults to80and443.RAGFLOW_DEV_MODESet totrueonly for development checkouts that intentionally use a development migration marker. Keep itfalsein production.RAGFLOW_IMAGEThe Go Docker image used bydocker-compose.yml. Use an official Go image tag documented in its release notes, or use the locally builtragflow:go-localtag. The RAGFlow Docker image does not include embedding models.
Local embedding service
The optional tei-cpu and tei-gpu profiles start a local text-embeddings-inference service. Its memory requirement depends on the model, runtime backend, precision, batch-token limit, and concurrency. The tei-cpu profile uses system RAM; the tei-gpu profile primarily uses GPU memory and also consumes system RAM. Verify model loading and peak request usage on the target hardware, and leave additional host memory for RAGFlow, the document engine, databases, and operating system.
DeepDoc (in-process)
DeepDoc layout analysis (DLA), OCR (text detection/recognition), and table structure recognition (TSR) run in-process inside the RAGFlow server using ONNX Runtime — there is no separate DeepDoc service to deploy. ONNX Runtime is statically linked into the server binary (resolved at runtime via dlopen(NULL); no libonnxruntime.so is required) and the models are loaded at runtime; DEEPDOC_MODEL_DIR overrides the default model directory. Dockerfile copies the required model assets into /ragflow/internal/rag/res/deepdoc.
In the RAGFlow open-source 1.0 release, DeepDoc uses CPU inference.
Timezone
TZThe local time zone. Defaults to'Asia/Shanghai'.
Hugging Face mirror site
HF_ENDPOINTThe mirror site for huggingface.co. It is disabled by default. You can uncomment this line if you have limited access to the primary Hugging Face domain.
Embedding batch size
TOKENIZER_EMBEDDING_BATCH_SIZEAn optional positive integer that overrides the number of text chunks sent in each embedding request. When it is not set, RAGFlow uses the embedding model's batch size, or16if the model does not provide one. Larger values can increase memory usage and may exceed the model provider's request limit; increase it gradually and verify parsing on representative documents.
🐋 Service configuration
service_conf.yaml.template specifies the system-level configuration for the Go API, Admin, Ingestor, and Syncer services. In a dockerized setup, the generated service_conf.yaml file is automatically created from this template (replacing all environment variables by their values).
-
ragflowhost: The API server's IP address inside the Docker container. Defaults to0.0.0.0.http_port: The API server's serving port inside the Docker container. Defaults to9380.
-
adminhost: The Admin server's IP address inside the Docker container. Defaults to0.0.0.0.http_port: The Admin server's serving port inside the Docker container. Defaults to9381.
-
mysqlname: The MySQL database name. Defaults torag_flow.user: The username for MySQL.password: The password for MySQL.port: The MySQL serving port inside the Docker container. Defaults to3306.max_connections: The maximum number of concurrent connections in the MySQL connection pool. Defaults to900.stale_timeout: The connection stale timeout in seconds. Defaults to300.max_allowed_packet: The maximum communication packet size. Defaults to1073741824bytes (1 GiB).
-
miniouser: The username for MinIO.password: The password for MinIO.host: The MinIO serving IP and port inside the Docker container. Defaults tominio:9000.
-
oceanbasescheme: The connection scheme. Set tomysqlto use mysql config, or other values to use config below.config:db_name: The OceanBase database name.user: The username for OceanBase.password: The password for OceanBase.host: The hostname of the OceanBase service.port: The port of OceanBase.
-
ossaccess_key: The access key ID used to authenticate requests to the OSS service.secret_key: The secret access key used to authenticate requests to the OSS service.endpoint_url: The URL of the OSS service endpoint.region: The OSS region where the bucket is located.bucket: The name of the OSS bucket where files will be stored. When you want to store all files in a specified bucket, you need this configuration item.prefix_path: Optional. A prefix path to prepend to file names in the OSS bucket, which can help organize files within the bucket.
-
s3:access_key: The access key ID used to authenticate requests to the S3 service.secret_key: The secret access key used to authenticate requests to the S3 service.endpoint_url: The URL of the S3-compatible service endpoint. This is necessary when using an S3-compatible protocol instead of the default AWS S3 endpoint.bucket: The name of the S3 bucket where files will be stored. When you want to store all files in a specified bucket, you need this configuration item.region: The AWS region where the S3 bucket is located. This is important for directing requests to the correct data center.signature_version: Optional. The version of the signature to use for authenticating requests. Common versions includev4.addressing_style: Optional. The style of addressing to use for the S3 endpoint. This can bepathorvirtual.prefix_path: Optional. A prefix path to prepend to file names in the S3 bucket, which can help organize files within the bucket.
-
oauthThe OAuth configuration for signing up or signing in to RAGFlow using a third-party account.<channel>: Custom channel ID.type: Authentication type, options includeoauth2,oidc,github. Default isoauth2, whenissuerparameter is provided, defaults tooidc.icon: Icon ID, options includegithub,sso, default issso.display_name: Channel name, defaults to the Title Case format of the channel ID.client_id: Required, unique identifier assigned to the client application.client_secret: Required, secret key for the client application, used for communication with the authentication server.authorization_url: Base URL for obtaining user authorization.token_url: URL for exchanging authorization code and obtaining access token.userinfo_url: URL for obtaining user information (username, email, etc.).issuer: Base URL of the identity provider. OIDC clients can dynamically obtain the identity provider's metadata (authorization_url,token_url,userinfo_url) throughissuer.scope: Requested permission scope, a space-separated string. For example,openid profile email.redirect_uri: Required, URI to which the authorization server redirects during the authentication flow to return results. Must match the callback URI registered with the authentication server. Format:https://your-app.com/api/v1/auth/oauth/<channel>/callback. For local configuration, you can directly usehttp://127.0.0.1:80/api/v1/auth/oauth/<channel>/callback.
📋 Setup Examples
🔒 HTTPS Setup
Prerequisites
- A registered domain name pointing to your server
- Port 80 and 443 open on your server
- Docker and Docker Compose installed
Getting and configuring certificates (Let's Encrypt)
If you want your instance to be available under https, follow these steps:
-
Install Certbot and obtain certificates
# Ubuntu/Debian sudo apt update && sudo apt install certbot # CentOS/RHEL sudo yum install certbot # Obtain certificates (replace with your actual domain) sudo certbot certonly --standalone -d your-ragflow-domain.com -
Locate your certificates Once generated, your certificates will be located at:
- Certificate:
/etc/letsencrypt/live/your-ragflow-domain.com/fullchain.pem - Private key:
/etc/letsencrypt/live/your-ragflow-domain.com/privkey.pem
- Certificate:
-
Update docker-compose.yml Add the certificate volumes to the
ragflow-cpuservice indocker-compose.yml:services: ragflow-cpu: # ...existing configuration... volumes: # SSL certificates - /etc/letsencrypt/live/your-ragflow-domain.com/fullchain.pem:/etc/nginx/ssl/fullchain.pem:ro - /etc/letsencrypt/live/your-ragflow-domain.com/privkey.pem:/etc/nginx/ssl/privkey.pem:ro # Switch to HTTPS nginx configuration - ./nginx/ragflow.https.conf:/etc/nginx/conf.d/ragflow.conf # ...other existing volumes... -
Update nginx configuration Edit
nginx/ragflow.https.confand replacemy_ragflow_domain.comwith your actual domain name. -
Restart the services
docker compose -f docker-compose.yml down docker compose -f docker-compose.yml up -d
⚠️ Important:
- Ensure your domain's DNS A record points to your server's IP address.
- Stop any services running on ports 80/443 before obtaining certificates with
--standalone.
💡 Tip: For development or testing, you can use self-signed certificates, but browsers will show security warnings.
Alternative: Using existing certificates
If you already have SSL certificates from another provider:
- Place your certificates in a directory accessible to Docker
- Update the volume paths in
docker-compose.ymlto point to your certificate files - Ensure the certificate file contains the full certificate chain
- Follow steps 4-5 from the Let's Encrypt guide above