docs/en/developers/development-environment/dev-env-setup.md
This directory provides Docker-based build tools for StarRocks that use the official starrocks/dev-env-ubuntu:latest development environment image. This ensures consistent builds across different host systems by using a standardized Ubuntu environment with all required toolchains and dependencies pre-installed.
# Open development shell
./docker-dev.sh shell
# Build Frontend only
./docker-dev.sh build-fe
# Build Backend only
./docker-dev.sh build-be
# Build everything
./docker-dev.sh build-all
# Clean build everything
./docker-dev.sh clean-build
# Run Frontend tests
./docker-dev.sh test-fe
build-in-docker.sh - Full-Featured Build ScriptThe main build script that automatically passes through all build.sh options:
# Basic usage
./build-in-docker.sh # Build all (FE + BE)
./build-in-docker.sh --fe # Build Frontend only
./build-in-docker.sh --be # Build Backend only
./build-in-docker.sh --fe --be --clean # Clean and build both
# Advanced options
./build-in-docker.sh --be --with-gcov # Build BE with code coverage
./build-in-docker.sh --fe --disable-java-check-style # Skip checkstyle
./build-in-docker.sh --be -j 8 # Build with 8 parallel jobs
# Development
./build-in-docker.sh --shell # Interactive shell
./build-in-docker.sh --test # Build and run tests
# Custom image
./build-in-docker.sh --image starrocks/dev-env-ubuntu:latest --fe
# Future build.sh options work automatically
./build-in-docker.sh --be --new-future-option
docker-dev.sh - Simple WrapperQuick commands for common tasks:
./docker-dev.sh shell # Development shell
./docker-dev.sh build-fe # Build Frontend
./docker-dev.sh build-be # Build Backend
./docker-dev.sh build-all # Build everything
./docker-dev.sh clean-build # Clean and build all
./docker-dev.sh test-fe # Run FE tests
./docker-dev.sh test-be # Run BE tests
./docker-dev.sh test-all # Run all tests
# Pass through any build.sh options
./docker-dev.sh build --be --with-gcov
./docker-dev.sh build --fe --new-option
docker-compose.dev.yml - Docker ComposeFor persistent development environments:
# Start development shell
docker-compose -f docker-compose.dev.yml run --rm starrocks-dev
# Build Frontend
docker-compose -f docker-compose.dev.yml run --rm build-fe
# Build Backend
docker-compose -f docker-compose.dev.yml run --rm build-be
# Run tests
docker-compose -f docker-compose.dev.yml run --rm test-fe
docker-compose -f docker-compose.dev.yml run --rm test-be
# Clean up
docker-compose -f docker-compose.dev.yml down -v
The Docker scripts automatically mount:
$(pwd):/workspace - Your local repository~/.m2:/tmp/.m2 - Maven dependencies cache for faster buildsNote: The Maven cache is shared between your host system and the Docker container, so dependencies downloaded during builds are persisted and reused across build sessions.
# Use different Docker image
export STARROCKS_DEV_ENV_IMAGE=starrocks/dev-env-ubuntu:latest
# Additional Docker options
export DOCKER_BUILD_OPTS="--memory=16g --cpus=8"
# Set user ID for file permissions
export UID=$(id -u)
export GID=$(id -g)
All original build.sh options are supported:
# Backend build types
BUILD_TYPE=Debug ./build-in-docker.sh --be # Debug build
BUILD_TYPE=Release ./build-in-docker.sh --be # Release build (default)
BUILD_TYPE=Asan ./build-in-docker.sh --be # AddressSanitizer build
# Feature flags
./build-in-docker.sh --be --enable-shared-data # Enable shared data
./build-in-docker.sh --be --with-gcov # Code coverage
./build-in-docker.sh --be --with-bench # Benchmarks
./build-in-docker.sh --be --without-avx2 # Disable AVX2
Build artifacts are created in the output/ directory:
output/
āāā fe/ # Frontend artifacts
āāā be/ # Backend artifacts
āāā java-extensions/ # Java extensions
The Docker container mounts your local repository and Maven cache, so all build outputs are available on your host system and dependencies are cached for faster subsequent builds.
Multi-User Support: Container names include username and user ID to prevent conflicts on shared development machines (e.g., starrocks-build-username-1001-1234567890).
Automatic Extensibility: All unrecognized options are automatically passed through to build.sh, so new build options work without updating the Docker scripts.
Permission Issues
# Fix file permissions
sudo chown -R $(id -u):$(id -g) output/
# Or run with correct user
export UID=$(id -u) GID=$(id -g)
./build-in-docker.sh --fe
Out of Memory
# Increase Docker memory limit or reduce parallel jobs
./build-in-docker.sh --be -j 2
Docker Image Not Found
# Pull the image manually
docker pull starrocks/dev-env-ubuntu:latest
Build Failures
# Clean build
./build-in-docker.sh --clean --fe --be
# Check logs in interactive shell
./build-in-docker.sh --shell
For debugging build issues:
# Open shell and run commands manually
./build-in-docker.sh --shell
# Inside container:
./build.sh --fe --clean
./run-fe-ut.sh
Test that everything works:
# 1. Test Docker setup
docker --version
docker info
# 2. Test image availability
docker pull starrocks/dev-env-ubuntu:latest
# 3. Test build scripts
./docker-dev.sh shell
# Inside container: exit
# 4. Test simple build
./docker-dev.sh build-fe
./build-in-docker.sh --be -j $(nproc)~/.m2 for faster dependency resolutionCreate .devcontainer/devcontainer.json:
{
"name": "StarRocks Dev Environment",
"image": "starrocks/dev-env-ubuntu:latest",
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind",
"workspaceFolder": "/workspace",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"redhat.java"
]
}
}
}
Use the Docker integration to run builds and tests within the container environment.
If you encounter issues:
--clean flag