This article describes how to use Docker to build a Doris development image, compile and run FE/BE, and combine it with VSCode Remote for development and debugging.
| Component | Description |
|---|---|
| Docker | Installed and running |
| VSCode | Latest stable version |
| Remote plugin | VSCode Remote - Containers / SSH |
Create a Dockerfile in the working directory. In VSCode, you can use Ctrl+D to replace the following placeholders:
| Placeholder | Meaning |
|---|---|
<!!! your user !!!> | Username created in the container |
<!!! your user password !!!> | Password for that user |
<!!! root password !!!> | Password for the root user |
<!!! your git email !!!> | Email for git configuration |
<!!! your git username !!!> | Username for git configuration |
FROM apache/incubator-doris:build-env-latest USER root WORKDIR /root RUN echo '<!!! root password !!!>' | passwd root --stdin RUN yum install -y vim net-tools man wget git mysql lsof bash-completion \ && cp /var/local/thirdparty/installed/bin/thrift /usr/bin # For better safety, create a user instead of using root RUN yum install -y sudo \ && useradd -ms /bin/bash <!!! your user !!!> && echo <!!! your user password !!!> | passwd <!!! your user !!!> --stdin \ && usermod -a -G wheel <!!! your user !!!> USER <!!! your user !!!> WORKDIR /home/<!!! your user !!!> RUN git config --global color.ui true \ && git config --global user.email "<!!! your git email !!!>" \ && git config --global user.name "<!!! your git username !!!>" # Optionally install zsh and oh my zsh for easier use; remove if not needed USER root RUN yum install -y zsh \ && chsh -s /bin/zsh <!!! your user !!!> USER <!!! your user !!!> RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh \ && git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \ && git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
docker build -t doris .
For mount options, refer to Docker Compilation Mount Notes. It is recommended to run the image by mounting the local Doris source directory.
:::caution Windows users On Windows, mounting involves cross-filesystem access issues. Configure at your own discretion. :::
The --cap-add SYS_PTRACE parameter allows the use of ptrace inside Docker, which helps with ptrace and GDB remote debugging:
docker run -it --cap-add SYS_PTRACE doris:latest /bin/bash
| Parameter | Purpose |
|---|---|
--cap-add SYS_PTRACE | Allows calling ptrace inside the container (required by GDB) |
-it | Interactive TTY |
-v <local>:<container> | Mount a local source directory (as needed) |
If you chose to install zsh, replace the plugins line in ~/.zshrc:
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
su <your user> mkdir code && cd code git clone https://github.com/apache/doris.git cd doris git submodule update --init --recursive
:::caution First-time compilation For the first compilation, use the following command to force a clean build:
sh build.sh --clean --be --fe --ui
The build-env-for-0.15.0 image upgraded thrift (0.9 to 0.13), so you must use --clean to force the new version of thrift to generate the code files, otherwise incompatible code will appear. :::
After that, compile Doris normally:
sh build.sh
Manually create the meta_dir directory for metadata storage. The default value is ${DORIS_HOME}/doris-meta:
mkdir meta_dir
cd output/fe sh bin/start_fe.sh --daemon
cd output/be sh bin/start_be.sh --daemon
mysql -h 127.0.0.1 -P 9030 -u root
ptrace: Operation not permittedThe container was not started with --cap-add SYS_PTRACE. Restart the container with that parameter added.
The first compilation did not include --clean. Clean up and recompile using the command in section 3.
Check whether meta_dir and storage_root_path have been created, whether the ports are unoccupied, and whether priority_networks covers the container IP.
The SYS_PTRACE capability was not added, or the VSCode C/C++ plugin does not specify a suitable miDebuggerPath.