This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push:
new 1c0bfc81055f [docs] Make Docker compilation workflow consistent and
easier to follow (#4626)
1c0bfc81055f is described below
commit 1c0bfc81055f5b3cdc39159400ce45bd1685d1b2
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Fri Nov 13 08:04:14 2026 +0800
[docs] Make Docker compilation workflow consistent and easier to follow
(#4626)
Use one branch/image/source-directory configuration throughout image
selection, cloning and Docker mounts. Start the container in the mounted
source directory, show one default Bash build, move optional image/JDK
notes after the main workflow, and document the scoped Git ownership
exception requested in the issue comments.
Fixes #3540
Versions and languages: community guide, English and Chinese.
Source verification:
- Doris master build.sh uses a Bash shebang, BASH_SOURCE and pipefail
- Doris master docker/compilation/Dockerfile starts /bin/bash and sets
JAVA_HOME to JDK17; env.sh requires JDK17
- Git config local manual documents safe.directory as a per-path
exception for intentionally shared repositories
- Previous guide cloned into ./doris but mounted ~/doris-branch-2.0,
leaving the displayed commands inconsistent
Validation:
- Ran bash -n on every Bash code fence in both edited guides
- Checked chosen branch, image, clone destination, volume mount and
container workdir use the same variables/paths
- Confirmed optional note headings are preserved and archive docs
unchanged
- git diff --check
Review:
- Goal: correct the reported documentation issue; the changed content
directly addresses it.
- Scope: targeted documentation edits.
- Information architecture: active version and locale counterparts
inspected; archived snapshots unchanged.
- Navigation: no paths, slugs, anchors or sidebar entries changed.
- Frontend/build: no framework, styling or build-script changes.
- Validation limits: no live Doris execution or full website build
performed.
- Other concerns: Existing headings and links are preserved; new
optional-build and FAQ headings add navigation targets. No build was run
and no Docker image was pulled.
Co-authored-by: morningman <[email protected]>
---
.../source-install/compilation-with-docker.md | 109 ++++++++++++---------
.../source-install/compilation-with-docker.md | 109 ++++++++++++---------
2 files changed, 120 insertions(+), 98 deletions(-)
diff --git a/community/source-install/compilation-with-docker.md
b/community/source-install/compilation-with-docker.md
index e7a9b9cd358b..1f0e42330992 100644
--- a/community/source-install/compilation-with-docker.md
+++ b/community/source-install/compilation-with-docker.md
@@ -79,36 +79,14 @@ Different Doris versions correspond to different build
images. `apache/doris:bui
| `apache/doris:build-env-ldb-toolchain-latest` | master | Tracks the trunk |
| `apache/doris:build-env-ldb-toolchain-no-avx2-latest` | master | Compatible
with CPUs that do not support AVX2 |
-Taking compilation of Doris 2.0 as an example, download and check the image:
+Run these commands on the host. This example builds `master`; for a release
branch, change both the branch and image using the table above. Run the
remaining host commands in the same shell to retain these variables. For ARM64
and JDK variations, see [Notes on Image Selection](#notes-on-image-selection).
```bash
-# You can also use docker.io/apache/doris:build-env-for-2.0
-docker pull apache/doris:build-env-for-2.0
+DORIS_BRANCH=master
+DORIS_BUILD_IMAGE=apache/doris:build-env-ldb-toolchain-latest
+DORIS_SOURCE_DIR="$PWD/doris"
-# Confirm that the image has been downloaded successfully
-docker images
-# REPOSITORY TAG IMAGE ID CREATED SIZE
-# apache/doris build-env-for-2.0 f29cf1979dba 3 days ago 3.3GB
-```
-
-### Notes on Image Selection
-
-- Image tags map one-to-one to Doris versions. Select the image that matches
the target branch and avoid cross-version compilation.
-- The third-party libraries in `no-avx2` images can run on CPUs that do not
support AVX2. They must be compiled together with the `USE_AVX2=0` option.
-- For the image change history, refer to the [thirdparty
CHANGELOG](https://github.com/apache/doris/blob/master/thirdparty/CHANGELOG.md).
-- The latest `apache/doris:build-env-ldb-toolchain-latest` (currently only
supports the x86_64 architecture) includes both JDK 8 and JDK 17. Use JDK 8 for
versions 2.1 and earlier, and use JDK 17 for versions 3.0 and later or the
master branch.
-- When compiling with Docker on the ARM64 architecture, first download an
ARM64-compatible Linux base image (such as `apache/doris:base-latest`, which
corresponds to Ubuntu 22.04.5 LTS), and then refer to the [Linux direct
compilation](./compilation-linux) and [ARM platform
compilation](./compilation-arm) documents to install dependencies and compile.
-
-Inside the container, switch the JDK through environment variables:
-
-```bash
-# Switch to JDK 8
-export JAVA_HOME=/usr/lib/jvm/java-1.8.0
-export PATH=$JAVA_HOME/bin/:$PATH
-
-# Switch to JDK 17
-export JAVA_HOME=/usr/lib/jvm/jdk-17.0.2/
-export PATH=$JAVA_HOME/bin/:$PATH
+docker pull "$DORIS_BUILD_IMAGE"
```
## 3. Compile Doris
@@ -117,36 +95,34 @@ export PATH=$JAVA_HOME/bin/:$PATH
### 3.1 Download the Doris Source Code
-On the host machine, fetch the code for the target branch (using branch-2.0 as
an example):
+On the host, clone the selected branch into the directory configured above:
```bash
-git clone -b branch-2.0 https://github.com/apache/doris.git
+git clone --branch "$DORIS_BRANCH" https://github.com/apache/doris.git
"$DORIS_SOURCE_DIR"
```
-Assume the source directory is `~/doris-branch-2.0`.
-
### 3.2 Start the Build Container
```bash
-# Prepare the maven .m2 directory on the host in advance so that Java
dependencies can be reused across multiple builds
-mkdir ~/.m2
+mkdir -p "$HOME/.m2"
-# Mount the source code and the .m2 directory, then start the build image
docker run -it --network=host \
- --name mydocker \
- -v ~/.m2:/root/.m2 \
- -v ~/doris-branch-2.0:/root/doris-branch-2.0/ \
- apache/doris:build-env-for-2.0
-
-# After the command runs successfully, it enters the container automatically
+ --name doris-build \
+ -v "$HOME/.m2:/root/.m2" \
+ -v "$DORIS_SOURCE_DIR:/root/doris" \
+ --workdir /root/doris \
+ "$DORIS_BUILD_IMAGE"
```
+The command opens Bash inside the container, with the mounted source directory
`/root/doris` as the working directory.
+
Explanation of the key `docker run` parameters:
| Parameter | Purpose |
| ---- | ---- |
| `-v` | Mounts a host directory into the container, used to persist source
code and dependencies |
| `--name` | Specifies the container name for easier management later |
+| `--workdir` | Starts the shell in the mounted source directory |
| `--network` | Sets the container network mode. `host` shares the network
stack with the host and requires no port mapping |
Recommendations:
@@ -157,17 +133,10 @@ Recommendations:
### 3.3 Run the Build
-After entering the source directory inside the container, run:
+Inside the container, run the default build:
```bash
-# By default, compile artifacts that support AVX2
-sh build.sh
-
-# When the CPU does not support AVX2, append USE_AVX2=0
-USE_AVX2=0 sh build.sh
-
-# Compile the Debug version of BE
-BUILD_TYPE=Debug sh build.sh
+bash build.sh
```
When the build finishes, the artifacts are located under `output/` in the
source directory.
@@ -182,6 +151,38 @@ cat /proc/cpuinfo | grep avx2
Non-empty output means AVX2 is supported.
:::
+### Other Build Options
+
+Choose one of these commands instead of the default build when needed:
+
+```bash
+# For CPUs without AVX2
+USE_AVX2=0 bash build.sh
+
+# Build the Debug version of BE
+BUILD_TYPE=Debug bash build.sh
+```
+
+### Notes on Image Selection
+
+- Image tags map one-to-one to Doris versions. Select the image that matches
the target branch and avoid cross-version compilation.
+- The third-party libraries in `no-avx2` images can run on CPUs that do not
support AVX2. They must be compiled together with the `USE_AVX2=0` option.
+- For the image change history, refer to the [thirdparty
CHANGELOG](https://github.com/apache/doris/blob/master/thirdparty/CHANGELOG.md).
+- The latest `apache/doris:build-env-ldb-toolchain-latest` (currently only
supports the x86_64 architecture) includes both JDK 8 and JDK 17. Use JDK 8 for
versions 2.1 and earlier, and use JDK 17 for versions 3.0 and later or the
master branch.
+- When compiling with Docker on the ARM64 architecture, first download an
ARM64-compatible Linux base image (such as `apache/doris:base-latest`, which
corresponds to Ubuntu 22.04.5 LTS), and then refer to the [Linux direct
compilation](./compilation-linux) and [ARM platform
compilation](./compilation-arm) documents to install dependencies and compile.
+
+Inside the container, switch the JDK through environment variables:
+
+```bash
+# Switch to JDK 8
+export JAVA_HOME=/usr/lib/jvm/java-1.8.0
+export PATH=$JAVA_HOME/bin/:$PATH
+
+# Switch to JDK 17
+export JAVA_HOME=/usr/lib/jvm/jdk-17.0.2/
+export PATH=$JAVA_HOME/bin/:$PATH
+```
+
## 4. Build Your Own Development Image
To customize the base image (for example, to switch to a different base
distribution or add debugging tools), refer to `docker/README.md` in the source
code.
@@ -204,6 +205,16 @@ Configure a Docker image mirror accelerator, or use the
full path `docker.io/apa
Verify that the container is started with `--network=host`, and that the
`~/.m2` directory is mounted into the container, so that a proxy or network
isolation does not make the Maven central repository unreachable.
+### Q5: Git reports `detected dubious ownership in repository`?
+
+A mounted source directory may be owned by a different host user. After
confirming that you trust the source repository, add an exception for its
mounted path inside the container:
+
+```bash
+git config --global --add safe.directory /root/doris
+```
+
+If you changed the container mount path, replace `/root/doris` accordingly.
+
## Related Documents
- [Compile with LDB Toolchain](./compilation-with-ldb-toolchain)
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs-community/current/source-install/compilation-with-docker.md
b/i18n/zh-CN/docusaurus-plugin-content-docs-community/current/source-install/compilation-with-docker.md
index 4a9d8b171977..e197f00096ca 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs-community/current/source-install/compilation-with-docker.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs-community/current/source-install/compilation-with-docker.md
@@ -79,36 +79,14 @@ yum install docker
| `apache/doris:build-env-ldb-toolchain-latest` | master | 跟随主干更新 |
| `apache/doris:build-env-ldb-toolchain-no-avx2-latest` | master | 兼容不支持 AVX2
的 CPU |
-以编译 Doris 2.0 为例,下载并检查镜像:
+以下命令在宿主机上执行。示例编译 `master`;编译发布分支时,请根据上表同时修改分支和镜像。后续宿主机命令在同一个 shell
中执行,以复用这些变量。ARM64 与 JDK 的额外说明见[镜像选择注意事项](#镜像选择注意事项)。
```bash
-# 也可以使用 docker.io/apache/doris:build-env-for-2.0
-docker pull apache/doris:build-env-for-2.0
+DORIS_BRANCH=master
+DORIS_BUILD_IMAGE=apache/doris:build-env-ldb-toolchain-latest
+DORIS_SOURCE_DIR="$PWD/doris"
-# 确认镜像下载成功
-docker images
-# REPOSITORY TAG IMAGE ID CREATED SIZE
-# apache/doris build-env-for-2.0 f29cf1979dba 3 days ago 3.3GB
-```
-
-### 镜像选择注意事项
-
-- 镜像 Tag 与 Doris 版本一一对应,请按目标分支选择,避免跨版本编译。
-- `no-avx2` 镜像中的第三方库可运行在不支持 AVX2 的 CPU 上,需配合 `USE_AVX2=0` 选项编译。
-- 镜像变更历史可参考 [thirdparty
CHANGELOG](https://github.com/apache/doris/blob/master/thirdparty/CHANGELOG.md)。
-- 最新的 `apache/doris:build-env-ldb-toolchain-latest`(目前仅支持 x86_64 架构)同时包含 JDK 8
与 JDK 17:2.1(含)之前版本请使用 JDK 8,3.0(含)之后版本或 master 分支请使用 JDK 17。
-- ARM64 架构下使用 Docker 编译时,需先下载支持 ARM64 的 Linux 基础镜像(如
`apache/doris:base-latest`,对应 Ubuntu 22.04.5 LTS),再参考 [Linux
直接编译](./compilation-linux) 和 [ARM 平台编译](./compilation-arm) 文档安装依赖后编译。
-
-容器内可通过环境变量切换 JDK:
-
-```bash
-# 切换到 JDK 8
-export JAVA_HOME=/usr/lib/jvm/java-1.8.0
-export PATH=$JAVA_HOME/bin/:$PATH
-
-# 切换到 JDK 17
-export JAVA_HOME=/usr/lib/jvm/jdk-17.0.2/
-export PATH=$JAVA_HOME/bin/:$PATH
+docker pull "$DORIS_BUILD_IMAGE"
```
## 3. 编译 Doris
@@ -117,36 +95,34 @@ export PATH=$JAVA_HOME/bin/:$PATH
### 3.1 下载 Doris 源码
-在宿主机上获取目标分支代码(以 branch-2.0 为例):
+在宿主机上,将所选分支克隆到上一步设置的目录:
```bash
-git clone -b branch-2.0 https://github.com/apache/doris.git
+git clone --branch "$DORIS_BRANCH" https://github.com/apache/doris.git
"$DORIS_SOURCE_DIR"
```
-假设源码目录为 `~/doris-branch-2.0`。
-
### 3.2 启动构建容器
```bash
-# 提前在宿主机准备 maven 的 .m2 目录,便于多次构建复用 Java 依赖
-mkdir ~/.m2
+mkdir -p "$HOME/.m2"
-# 挂载源码与 .m2 目录,启动构建镜像
docker run -it --network=host \
- --name mydocker \
- -v ~/.m2:/root/.m2 \
- -v ~/doris-branch-2.0:/root/doris-branch-2.0/ \
- apache/doris:build-env-for-2.0
-
-# 命令执行成功后将自动进入容器
+ --name doris-build \
+ -v "$HOME/.m2:/root/.m2" \
+ -v "$DORIS_SOURCE_DIR:/root/doris" \
+ --workdir /root/doris \
+ "$DORIS_BUILD_IMAGE"
```
+容器启动后会自动进入 Bash,工作目录为挂载的源码目录 `/root/doris`。
+
`docker run` 关键参数说明:
| 参数 | 作用 |
| ---- | ---- |
| `-v` | 将宿主机目录挂载到容器,用于持久化源码与依赖 |
| `--name` | 指定容器名称,便于后续管理 |
+| `--workdir` | 指定容器中的工作目录,直接进入挂载的源码目录 |
| `--network` | 容器网络模式。`host` 表示与宿主机共享网络栈,无需端口映射 |
建议:
@@ -157,17 +133,10 @@ docker run -it --network=host \
### 3.3 执行构建
-容器内进入源码目录后运行:
+在容器内执行默认构建:
```bash
-# 默认编译支持 AVX2 的产物
-sh build.sh
-
-# CPU 不支持 AVX2 时需附加 USE_AVX2=0
-USE_AVX2=0 sh build.sh
-
-# 编译 Debug 版本 BE
-BUILD_TYPE=Debug sh build.sh
+bash build.sh
```
编译完成后,产物位于源码目录下的 `output/`。
@@ -182,6 +151,38 @@ cat /proc/cpuinfo | grep avx2
输出非空即代表支持 AVX2。
:::
+### 其他构建选项
+
+按需选择以下命令替代默认构建命令:
+
+```bash
+# CPU 不支持 AVX2 时使用
+USE_AVX2=0 bash build.sh
+
+# 编译 Debug 版本 BE
+BUILD_TYPE=Debug bash build.sh
+```
+
+### 镜像选择注意事项
+
+- 镜像 Tag 与 Doris 版本一一对应,请按目标分支选择,避免跨版本编译。
+- `no-avx2` 镜像中的第三方库可运行在不支持 AVX2 的 CPU 上,需配合 `USE_AVX2=0` 选项编译。
+- 镜像变更历史可参考 [thirdparty
CHANGELOG](https://github.com/apache/doris/blob/master/thirdparty/CHANGELOG.md)。
+- 最新的 `apache/doris:build-env-ldb-toolchain-latest`(目前仅支持 x86_64 架构)同时包含 JDK 8
与 JDK 17:2.1(含)之前版本请使用 JDK 8,3.0(含)之后版本或 master 分支请使用 JDK 17。
+- ARM64 架构下使用 Docker 编译时,需先下载支持 ARM64 的 Linux 基础镜像(如
`apache/doris:base-latest`,对应 Ubuntu 22.04.5 LTS),再参考 [Linux
直接编译](./compilation-linux) 和 [ARM 平台编译](./compilation-arm) 文档安装依赖后编译。
+
+容器内可通过环境变量切换 JDK:
+
+```bash
+# 切换到 JDK 8
+export JAVA_HOME=/usr/lib/jvm/java-1.8.0
+export PATH=$JAVA_HOME/bin/:$PATH
+
+# 切换到 JDK 17
+export JAVA_HOME=/usr/lib/jvm/jdk-17.0.2/
+export PATH=$JAVA_HOME/bin/:$PATH
+```
+
## 4. 自行构建开发镜像
如需自定义基础镜像(例如更换基础发行版、增加调试工具),请参考源码中的 `docker/README.md`。
@@ -204,6 +205,16 @@ cat /proc/cpuinfo | grep avx2
确认容器启动时使用了 `--network=host`,并将 `~/.m2` 目录挂载到容器,避免代理或网络隔离导致 Maven 中央仓库不可达。
+### Q5: Git 提示 `detected dubious ownership in repository`?
+
+挂载的源码目录可能属于宿主机上的另一个用户。确认该目录是你信任的源码仓库后,在容器内为该挂载路径添加例外:
+
+```bash
+git config --global --add safe.directory /root/doris
+```
+
+如果修改了容器内的挂载路径,请相应替换 `/root/doris`。
+
## 相关文档
- [使用 LDB Toolchain 编译](./compilation-with-ldb-toolchain)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]