3.4 KiB
Deploying MinerU with Docker
MinerU provides a convenient Docker deployment method, which helps quickly set up the environment and solve some tricky environment compatibility issues.
Build Docker Image using Dockerfile:
wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/china/Dockerfile
docker build -t mineru-sglang:latest -f Dockerfile .
Tip
The Dockerfile uses
lmsysorg/sglang:v0.4.8.post1-cu126as the base image by default, supporting Turing/Ampere/Ada Lovelace/Hopper platforms. If you are using the newerBlackwellplatform, please modify the base image tolmsysorg/sglang:v0.4.8.post1-cu128-b200before executing the build operation.
Docker Description
MinerU's Docker uses lmsysorg/sglang as the base image, so it includes the sglang inference acceleration framework and necessary dependencies by default. Therefore, on compatible devices, you can directly use sglang to accelerate VLM model inference.
Note
Requirements for using
sglangto accelerate VLM model inference:
- Device must have Turing architecture or later graphics cards with 8GB+ available VRAM.
- The host machine's graphics driver should support CUDA 12.6 or higher;
Blackwellplatform should support CUDA 12.8 or higher. You can check the driver version using thenvidia-smicommand.- Docker container must have access to the host machine's graphics devices.
If your device doesn't meet the above requirements, you can still use other features of MinerU, but cannot use
sglangto accelerate VLM model inference, meaning you cannot use thevlm-sglang-enginebackend or start thevlm-sglang-serverservice.
Start Docker Container:
docker run --gpus all \
--shm-size 32g \
-p 30000:30000 -p 7860:7860 -p 8000:8000 \
--ipc=host \
-it mineru-sglang:latest \
/bin/bash
After executing this command, you will enter the Docker container's interactive terminal with some ports mapped for potential services. You can directly run MinerU-related commands within the container to use MinerU's features.
You can also directly start MinerU services by replacing /bin/bash with service startup commands. For detailed instructions, please refer to the MinerU Usage Documentation.
Start Services Directly with Docker Compose
We provide a compose.yml file that you can use to quickly start MinerU services.
# Download compose.yaml file
wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/compose.yaml
-
Start
sglang-serverservice and connect tosglang-serverviavlm-sglang-clientbackend:docker compose -f compose.yaml --profile mineru-sglang-server up -d # In another terminal, connect to sglang server via sglang client (only requires CPU and network, no sglang environment needed) mineru -p <input_path> -o <output_path> -b vlm-sglang-client -u http://<server_ip>:30000 -
Start API service:
docker compose -f compose.yaml --profile mineru-api up -dAccess
http://<server_ip>:8000/docsin your browser to view the API documentation. -
Start Gradio WebUI service:
docker compose -f compose.yaml --profile mineru-gradio up -dAccess
http://<server_ip>:7860in your browser to use the Gradio WebUI or accesshttp://<server_ip>:7860/?view=apito use the Gradio API.