@ -1,6 +1,6 @@
|
||||
---
|
||||
{
|
||||
"title": "Construct Docker Compose",
|
||||
"title": "Build Docker Compose",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
@ -24,7 +24,7 @@ specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# Construct Docker Compose
|
||||
# Build Docker Compose
|
||||
|
||||
*Todo*
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
{
|
||||
"title": "Construct Docker Image",
|
||||
"title": "Build Docker Image",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
@ -24,17 +24,17 @@ specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# Construct Docker Image
|
||||
# Build Docker Image
|
||||
|
||||
This document mainly introduces how to make a running image of Apache Doris through Dockerfile, so that an Apache Doris Image can be quickly pulled in a containerized orchestration tool or during a quick test to complete the cluster creation.
|
||||
This topic is about how to build a running image of Apache Doris through Dockerfile, so that an Apache Doris image can be quickly pulled in a container orchestration tool or during a quick test to complete the cluster creation.
|
||||
|
||||
## Software and hardware requirements
|
||||
## Software and Hardware Requirements
|
||||
|
||||
### Overview
|
||||
|
||||
Before making a Docker image, the production machine must be prepared in advance. The platform architecture of the machine determines the applicable platform architecture of the Docker Image after production. For example, the X86_64 machine needs to download the Doris binary program of X86_64. The image after production can only be used on the X86_64 platform run on. The ARM platform (M1 is regarded as ARM) is the same.
|
||||
Prepare the production machine before building a Docker image. The platform architecture of the Docker image will be the same as that of the machine. For example, if you use an X86_64 machine to build a Docker image, you need to download the Doris binary program of X86_64, and the Docker image built can only run on the X86_64 platform. The ARM platform (or M1), likewise.
|
||||
|
||||
### Hardware requirements
|
||||
### Hardware Requirements
|
||||
|
||||
Minimum configuration: 2C 4G
|
||||
|
||||
@ -42,17 +42,17 @@ Recommended configuration: 4C 16G
|
||||
|
||||
### Software Requirements
|
||||
|
||||
Docker Version: 20.10 and later
|
||||
Docker Version: 20.10 or newer
|
||||
|
||||
## Docker Image build
|
||||
## Build Docker Image
|
||||
|
||||
Dockerfile scripting needs to pay attention to the following points:
|
||||
> 1. The base parent image uses the official OpenJDK image certified by Docker-Hub, and the version uses JDK 1.8
|
||||
> 2. The application uses the official binary package for download by default, do not use binary packages from unknown sources
|
||||
> 3. Embedded scripts are required to complete tasks such as FE startup, multi-FE registration, status check and BE startup, registration of BE to FE, status check, etc.
|
||||
> 4. The application should not be started using `--daemon` when starting in Docker, otherwise there will be exceptions during the deployment of orchestration tools such as K8S
|
||||
During Dockerfile scripting, please note that:
|
||||
> 1. Use the official OpenJDK image certified by Docker-Hub as the base parent image (Version: JDK 1.8).
|
||||
> 2. Use the official binary package for download; do not use binary packages from unknown sources.
|
||||
> 3. Use embedded scripts for tasks such as FE startup, multi-FE registration, FE status check, BE startup, registration of BE to FE, and BE status check.
|
||||
> 4. Do not use `--daemon` to start applications in Docker. Otherwise there will be exceptions during the deployment of orchestration tools such as K8S.
|
||||
|
||||
Since Apache Doris 1.2 began to support JavaUDF capability, BE also needs a JDK environment. The recommended mirror is as follows:
|
||||
Apache Doris 1.2 and the subsequent versions support JavaUDF, so you also need a JDK environment for BE. The recommended images are as follows:
|
||||
|
||||
| Doris Program | Recommended Base Parent Image |
|
||||
| ---------- | ----------------- |
|
||||
@ -60,23 +60,23 @@ Since Apache Doris 1.2 began to support JavaUDF capability, BE also needs a JDK
|
||||
| Backend | openjdk:8u342-jdk |
|
||||
| Broker | openjdk:8u342-jdk |
|
||||
|
||||
### Script preparation
|
||||
### Script Preparation
|
||||
|
||||
In the Dockerfile script for compiling the Docker Image, there are two ways to load the binary package of the Apache Doris program:
|
||||
In the Dockerfile script for compiling the Docker Image, there are two methods to load the binary package of the Apache Doris program:
|
||||
|
||||
1. Execute the download command at compile time via wget / curl, and then complete the docker build process
|
||||
2. Download the binary package to the compilation directory in advance, and then load it into the docker build process through the ADD or COPY command
|
||||
1. Execute the download command via wget / curl when compiling, and then start the docker build process.
|
||||
2. Download the binary package to the compilation directory in advance, and then load it into the docker build process through the ADD or COPY command.
|
||||
|
||||
Using the former will make the Docker Image Size smaller, but if the build fails, the download operation may be repeated, resulting in a long build time, while the latter is more suitable for a build environment where the network environment is not very good. The image built by the latter is slightly larger than the former, but not much larger.
|
||||
Method 1 can produce a smaller Docker image, but if the docker build process fails, the download operation might be repeated and result in longer build time; Method 2 is more suitable for less-than-ideal network environments. Method 2 will produce a Docker image that is slightly larger than that from Method 1.
|
||||
|
||||
**To sum up, the examples in this document are subject to the second method. If you have the first request, you can customize and modify it according to your own needs. **
|
||||
**The examples below are based on Method 2. If you prefer to go for Method 1, you may modify the steps accordingly.**
|
||||
|
||||
### Prepare binary package
|
||||
### Prepare Binary Package
|
||||
|
||||
It should be noted that if there is a need for customized development, you need to modify the source code and then [compile](../source-install/compilation) to package it, and then place it in the build directory.
|
||||
Please noted that if you have a need for custom development, you need to modify the source code, [compile](../source-install/compilation) and package it, and then place it in the build directory.
|
||||
|
||||
If there is no special requirement, just [download](https://doris.apache.org/download) the binary package provided by the official website.
|
||||
### Build Steps
|
||||
If you have no such needs, you can just [download](https://doris.apache.org/download) the binary package from the official website.
|
||||
### Steps
|
||||
|
||||
#### Build FE
|
||||
|
||||
@ -100,17 +100,17 @@ The build environment directory is as follows:
|
||||
|
||||
Copy the binary package to the `./docker-build/fe/resource` directory
|
||||
|
||||
3. Write FE's Dockerfile script
|
||||
3. Write the Dockerfile script for FE
|
||||
|
||||
```powershell
|
||||
# select the base image
|
||||
# Select the base image
|
||||
FROM openjdk:8u342-jdk
|
||||
|
||||
# Set environment variables
|
||||
ENV JAVA_HOME="/usr/local/openjdk-8/" \
|
||||
PATH="/opt/apache-doris/fe/bin:$PATH"
|
||||
|
||||
# Download the software to the mirror and replace it as needed
|
||||
# Download the software into the image (you can modify based on your own needs)
|
||||
ADD ./resource/apache-doris-fe-${x.x.x}-bin.tar.gz /opt/
|
||||
|
||||
RUN apt-get update && \
|
||||
@ -126,19 +126,19 @@ The build environment directory is as follows:
|
||||
ENTRYPOINT ["/opt/apache-doris/fe/bin/init_fe.sh"]
|
||||
```
|
||||
|
||||
After writing, name it `Dockerfile` and save it to the `./docker-build/fe` directory
|
||||
After writing, name it `Dockerfile` and save it to the `./docker-build/fe` directory.
|
||||
|
||||
4. Write the execution script of FE
|
||||
|
||||
You can refer to the content of copying [init_fe.sh](https://github.com/apache/doris/tree/master/docker/runtime/fe/resource/init_fe.sh)
|
||||
You can refer to [init_fe.sh](https://github.com/apache/doris/tree/master/docker/runtime/fe/resource/init_fe.sh).
|
||||
|
||||
After writing, name it `init_fe.sh` and save it to the `./docker-build/fe/resouce` directory
|
||||
After writing, name it `init_fe.sh` and save it to the `./docker-build/fe/resouce` directory.
|
||||
|
||||
5. Execute the build
|
||||
|
||||
It should be noted that `${tagName}` needs to be replaced with the tag name you want to package and name, such as: `apache-doris:1.1.3-fe`
|
||||
Please note that `${tagName}` needs to be replaced with the tag name you want to package and name, such as: `apache-doris:1.1.3-fe`
|
||||
|
||||
Build FEs:
|
||||
Build FE:
|
||||
|
||||
```shell
|
||||
cd ./docker-build/fe
|
||||
@ -162,17 +162,17 @@ mkdir -p ./docker-build/be/resource
|
||||
└── apache-doris-x.x.x-bin-x86_64/arm-be.tar.gz // binary package
|
||||
```
|
||||
|
||||
3. Write BE's Dockerfile script
|
||||
3. Write the Dockerfile script for BE
|
||||
|
||||
```powershell
|
||||
# select the base image
|
||||
# Select the base image
|
||||
FROM openjdk:8u342-jdk
|
||||
|
||||
# Set environment variables
|
||||
ENV JAVA_HOME="/usr/local/openjdk-8/" \
|
||||
PATH="/opt/apache-doris/be/bin:$PATH"
|
||||
|
||||
# Download the software to the mirror and replace it as needed
|
||||
# Download the software into the image (you can modify based on your own needs)
|
||||
ADD ./resource/apache-doris-be-${x.x.x}-bin-x86_64.tar.gz /opt/
|
||||
|
||||
RUN apt-get update && \
|
||||
@ -192,22 +192,22 @@ mkdir -p ./docker-build/be/resource
|
||||
|
||||
4. Write the execution script of BE
|
||||
|
||||
You can refer to the content of copying [init_be.sh](https://github.com/apache/doris/tree/master/docker/runtime/be/resource/init_be.sh)
|
||||
You can refer to [init_be.sh](https://github.com/apache/doris/tree/master/docker/runtime/be/resource/init_be.sh).
|
||||
|
||||
After writing, name it `init_be.sh` and save it to the `./docker-build/be/resouce` directory
|
||||
After writing, name it `init_be.sh` and save it to the `./docker-build/be/resouce` directory.
|
||||
|
||||
5. Execute the build
|
||||
|
||||
It should be noted that `${tagName}` needs to be replaced with the tag name you want to package and name, such as: `apache-doris:1.1.3-be`
|
||||
Please note that `${tagName}` needs to be replaced with the tag name you want to package and name, such as: `apache-doris:1.1.3-be`
|
||||
|
||||
Build BEs:
|
||||
Build BE:
|
||||
|
||||
```shell
|
||||
cd ./docker-build/be
|
||||
docker build . -t ${be-tagName}
|
||||
```
|
||||
|
||||
After the construction is complete, there will be a prompt of `Success`. At this time, the following command can be used to view the Image mirror that has just been built
|
||||
After the build process is completed, you will see the prompt `Success`. Then, you can check the built image using the following command.
|
||||
|
||||
```shell
|
||||
docker images
|
||||
@ -231,17 +231,17 @@ mkdir -p ./docker-build/broker/resource
|
||||
└── apache-doris-x.x.x-bin-broker.tar.gz // binary package
|
||||
```
|
||||
|
||||
3. Write Broker's Dockerfile script
|
||||
3. Write the Dockerfile script for Broker
|
||||
|
||||
```powershell
|
||||
# select the base image
|
||||
# Select the base image
|
||||
FROM openjdk:8u342-jdk
|
||||
|
||||
# Set environment variables
|
||||
ENV JAVA_HOME="/usr/local/openjdk-8/" \
|
||||
PATH="/opt/apache-doris/broker/bin:$PATH"
|
||||
|
||||
# Download the software to the mirror, where the broker directory is synchronously compressed to the binary package of FE, which needs to be decompressed and repackaged by itself, and can be replaced as needed
|
||||
# Download the software into the image, where the broker directory is synchronously compressed to the binary package of FE, which needs to be decompressed and repackaged (you can modify based on your own needs)
|
||||
ADD ./resource/apache_hdfs_broker.tar.gz /opt/
|
||||
|
||||
RUN apt-get update && \
|
||||
@ -261,13 +261,13 @@ mkdir -p ./docker-build/broker/resource
|
||||
|
||||
4. Write the execution script of BE
|
||||
|
||||
You can refer to the content of copying [init_broker.sh](https://github.com/apache/doris/tree/master/docker/runtime/broker/resource/init_broker.sh)
|
||||
You can refer to [init_broker.sh](https://github.com/apache/doris/tree/master/docker/runtime/broker/resource/init_broker.sh).
|
||||
|
||||
After writing, name it `init_broker.sh` and save it to the `./docker-build/broker/resouce` directory
|
||||
After writing, name it `init_broker.sh` and save it to the `./docker-build/broker/resouce` directory.
|
||||
|
||||
5. Execute the build
|
||||
|
||||
It should be noted that `${tagName}` needs to be replaced with the tag name you want to package and name, such as: `apache-doris:1.1.3-broker`
|
||||
Please note that `${tagName}` needs to be replaced with the tag name you want to package and name, such as: `apache-doris:1.1.3-broker`
|
||||
|
||||
Build Broker:
|
||||
|
||||
@ -276,21 +276,21 @@ mkdir -p ./docker-build/broker/resource
|
||||
docker build . -t ${broker-tagName}
|
||||
```
|
||||
|
||||
After the construction is complete, there will be a prompt of `Success`. At this time, the following command can be used to view the Image mirror that has just been built
|
||||
After the build process is completed, you will see the prompt `Success`. Then, you can check the built image using the following command.
|
||||
|
||||
```shell
|
||||
docker images
|
||||
```
|
||||
|
||||
## Push the image to DockerHub or private warehouse
|
||||
## Push Image to DockerHub or Private Warehouse
|
||||
|
||||
Log in to your DockerHub account
|
||||
Log into your DockerHub account
|
||||
|
||||
```
|
||||
docker login
|
||||
```
|
||||
|
||||
A successful login will prompt `Success` related prompts, and then push them to the warehouse
|
||||
If the login succeeds, you will see the prompt `Success` , and then you can push the Docker image to the warehouse.
|
||||
|
||||
```shell
|
||||
docker push ${tagName}
|
||||
|
||||
Reference in New Issue
Block a user