Update Dockerfile examples (#23103)

This commit is contained in:
Glenn Jocher 2026-01-02 03:29:19 +01:00 committed by GitHub
parent 5f2b3395f6
commit 171c26c6c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 89 additions and 138 deletions

View file

@ -45,37 +45,14 @@ RUN uv pip install --system -e "." albumentations faster-coco-eval wandb && \
# Remove extra build files \
rm -rf tmp /root/.config/Ultralytics/persistent_cache.json
# Usage Examples -------------------------------------------------------------------------------------------------------
# Usage --------------------------------------------------------------------------------------------------------------
# Build and Push
# t=ultralytics/ultralytics:latest && sudo docker build -f docker/Dockerfile -t $t . && sudo docker push $t
# Pull and Run with access to all GPUs
# t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --runtime=nvidia --gpus all $t
# Pull and Run with access to GPUs 2 and 3 (inside container CUDA devices will appear as 0 and 1)
# t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --runtime=nvidia --gpus '"device=2,3"' $t
# Pull and Run with local directory access
# t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --runtime=nvidia --gpus all -v "$(pwd)"/shared/datasets:/datasets $t
# Kill all
# sudo docker kill $(sudo docker ps -q)
# Kill all image-based
# sudo docker kill $(sudo docker ps -qa --filter ancestor=ultralytics/ultralytics:latest)
# DockerHub tag update
# t=ultralytics/ultralytics:latest tnew=ultralytics/ultralytics:v6.2 && sudo docker pull $t && sudo docker tag $t $tnew && sudo docker push $tnew
# Clean up
# sudo docker system prune -a --volumes
# Update Ubuntu drivers
# https://www.maketecheasier.com/install-nvidia-drivers-ubuntu/
# DDP test
# python -m torch.distributed.run --nproc_per_node 2 --master_port 1 train.py --epochs 3
# GCP VM from Image
# docker.io/ultralytics/ultralytics:latest
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
# Example (build): t=ultralytics/ultralytics:latest && docker build -f docker/Dockerfile -t $t .
# Example (push): docker push $t
# Example (pull): t=ultralytics/ultralytics:latest && docker pull $t
# Example (run-gpu): docker run -it --ipc=host --runtime=nvidia --gpus all $t
# Example (run-gpu-subset): docker run -it --ipc=host --runtime=nvidia --gpus "device=2,3" $t
# Note: device=2,3 maps to CUDA 0,1 inside the container.
# Example (run-with-volume): docker run -it --ipc=host --runtime=nvidia --gpus all -v "$PWD/shared/datasets:/datasets" $t
# Example (tag-release): t=ultralytics/ultralytics:latest tnew=ultralytics/ultralytics:vX.Y && docker tag $t $tnew && docker push $tnew

View file

@ -44,16 +44,11 @@ RUN python3 -m pip install uv && \
# Remove extra build files
rm -rf /root/.config/Ultralytics/persistent_cache.json
# Usage Examples -------------------------------------------------------------------------------------------------------
# Usage --------------------------------------------------------------------------------------------------------------
# Build and Push
# t=ultralytics/ultralytics:latest-arm64 && sudo docker build --platform linux/arm64 -f docker/Dockerfile-arm64 -t $t . && sudo docker push $t
# Run
# t=ultralytics/ultralytics:latest-arm64 && sudo docker run -it --ipc=host $t
# Pull and Run
# t=ultralytics/ultralytics:latest-arm64 && sudo docker pull $t && sudo docker run -it --ipc=host $t
# Pull and Run with local volume mounted
# t=ultralytics/ultralytics:latest-arm64 && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/datasets $t
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
# Example (build): t=ultralytics/ultralytics:latest-arm64 && docker build --platform linux/arm64 -f docker/Dockerfile-arm64 -t $t .
# Example (push): docker push $t
# Example (pull): t=ultralytics/ultralytics:latest-arm64 && docker pull $t
# Example (run): docker run -it --ipc=host $t
# Example (run-with-volume): docker run -it --ipc=host -v "$PWD/shared/datasets:/datasets" $t

View file

@ -33,16 +33,11 @@ RUN apt-get update && \
# Copy model
ADD https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n.pt .
# Usage Examples -------------------------------------------------------------------------------------------------------
# Usage --------------------------------------------------------------------------------------------------------------
# Build and Push
# t=ultralytics/ultralytics:latest-conda && sudo docker build -f docker/Dockerfile-conda -t $t . && sudo docker push $t
# Run
# t=ultralytics/ultralytics:latest-conda && sudo docker run -it --ipc=host $t
# Pull and Run
# t=ultralytics/ultralytics:latest-conda && sudo docker pull $t && sudo docker run -it --ipc=host $t
# Pull and Run with local volume mounted
# t=ultralytics/ultralytics:latest-conda && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/datasets $t
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
# Example (build): t=ultralytics/ultralytics:latest-conda && docker build -f docker/Dockerfile-conda -t $t .
# Example (push): docker push $t
# Example (pull): t=ultralytics/ultralytics:latest-conda && docker pull $t
# Example (run): docker run -it --ipc=host $t
# Example (run-with-volume): docker run -it --ipc=host -v "$PWD/shared/datasets:/datasets" $t

View file

@ -9,16 +9,11 @@ FROM ultralytics/ultralytics:latest-python
# Set default command to bash
CMD ["/bin/bash"]
# Usage Examples -------------------------------------------------------------------------------------------------------
# Usage --------------------------------------------------------------------------------------------------------------
# Build and Push
# t=ultralytics/ultralytics:latest-cpu && sudo docker build -f docker/Dockerfile-cpu -t $t . && sudo docker push $t
# Run
# t=ultralytics/ultralytics:latest-cpu && sudo docker run -it --ipc=host --name NAME $t
# Pull and Run
# t=ultralytics/ultralytics:latest-cpu && sudo docker pull $t && sudo docker run -it --ipc=host --name NAME $t
# Pull and Run with local volume mounted
# t=ultralytics/ultralytics:latest-cpu && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/datasets $t
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
# Example (build): t=ultralytics/ultralytics:latest-cpu && docker build -f docker/Dockerfile-cpu -t $t .
# Example (push): docker push $t
# Example (pull): t=ultralytics/ultralytics:latest-cpu && docker pull $t
# Example (run): docker run -it --ipc=host $t
# Example (run-with-volume): docker run -it --ipc=host -v "$PWD/shared/datasets:/datasets" $t

View file

@ -1,5 +1,6 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
# Builds ultralytics/ultralytics:latest-export image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
# Export-optimized derivative of ultralytics/ultralytics:latest for testing and benchmarks
# Includes all export format dependencies and pre-installed export packages
@ -14,3 +15,12 @@ RUN uv pip install --system -e ".[export]" "onnxruntime-gpu" paddlepaddle x2padd
yolo export model=tmp/yolo11n.pt format=ncnn imgsz=32 && \
# Remove temporary files \
rm -rf tmp /root/.config/Ultralytics/persistent_cache.json
# Usage --------------------------------------------------------------------------------------------------------------
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
# Example (build): t=ultralytics/ultralytics:latest-export && docker build -f docker/Dockerfile-export -t $t .
# Example (push): docker push $t
# Example (pull): t=ultralytics/ultralytics:latest-export && docker pull $t
# Example (run): docker run -it --ipc=host --runtime=nvidia --gpus all $t
# Example (run-with-volume): docker run -it --ipc=host --runtime=nvidia --gpus all -v "$PWD/shared/datasets:/datasets" $t

View file

@ -59,13 +59,11 @@ RUN uv pip install --system \
# Remove extra build files
rm -rf *.whl /root/.config/Ultralytics/persistent_cache.json
# Usage Examples -------------------------------------------------------------------------------------------------------
# Usage --------------------------------------------------------------------------------------------------------------
# Build and Push
# t=ultralytics/ultralytics:latest-jetson-jetpack4 && sudo docker build --platform linux/arm64 -f docker/Dockerfile-jetson-jetpack4 -t $t . && sudo docker push $t
# Run
# t=ultralytics/ultralytics:latest-jetson-jetpack4 && sudo docker run -it --ipc=host --runtime=nvidia $t
# Pull and Run
# t=ultralytics/ultralytics:latest-jetson-jetpack4 && sudo docker pull $t && sudo docker run -it --ipc=host --runtime=nvidia $t
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
# Example (build): t=ultralytics/ultralytics:latest-jetson-jetpack4 && docker build --platform linux/arm64 -f docker/Dockerfile-jetson-jetpack4 -t $t .
# Example (push): docker push $t
# Example (pull): t=ultralytics/ultralytics:latest-jetson-jetpack4 && docker pull $t
# Example (run): docker run -it --ipc=host --runtime=nvidia $t
# Example (run-with-volume): docker run -it --ipc=host --runtime=nvidia -v "$PWD/shared/datasets:/datasets" $t

View file

@ -48,13 +48,11 @@ RUN uv pip install --system \
# Remove extra build files
rm -rf *.whl /root/.config/Ultralytics/persistent_cache.json
# Usage Examples -------------------------------------------------------------------------------------------------------
# Usage --------------------------------------------------------------------------------------------------------------
# Build and Push
# t=ultralytics/ultralytics:latest-jetson-jetpack5 && sudo docker build --platform linux/arm64 -f docker/Dockerfile-jetson-jetpack5 -t $t . && sudo docker push $t
# Run
# t=ultralytics/ultralytics:latest-jetson-jetpack5 && sudo docker run -it --ipc=host --runtime=nvidia $t
# Pull and Run
# t=ultralytics/ultralytics:latest-jetson-jetpack5 && sudo docker pull $t && sudo docker run -it --ipc=host --runtime=nvidia $t
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
# Example (build): t=ultralytics/ultralytics:latest-jetson-jetpack5 && docker build --platform linux/arm64 -f docker/Dockerfile-jetson-jetpack5 -t $t .
# Example (push): docker push $t
# Example (pull): t=ultralytics/ultralytics:latest-jetson-jetpack5 && docker pull $t
# Example (run): docker run -it --ipc=host --runtime=nvidia $t
# Example (run-with-volume): docker run -it --ipc=host --runtime=nvidia -v "$PWD/shared/datasets:/datasets" $t

View file

@ -45,13 +45,11 @@ RUN python3 -m pip install --upgrade pip uv && \
# Remove extra build files
rm -rf *.whl /root/.config/Ultralytics/persistent_cache.json
# Usage Examples -------------------------------------------------------------------------------------------------------
# Usage --------------------------------------------------------------------------------------------------------------
# Build and Push
# t=ultralytics/ultralytics:latest-jetson-jetpack6 && sudo docker build --platform linux/arm64 -f docker/Dockerfile-jetson-jetpack6 -t $t . && sudo docker push $t
# Run
# t=ultralytics/ultralytics:latest-jetson-jetpack6 && sudo docker run -it --ipc=host --runtime=nvidia $t
# Pull and Run
# t=ultralytics/ultralytics:latest-jetson-jetpack6 && sudo docker pull $t && sudo docker run -it --ipc=host --runtime=nvidia $t
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
# Example (build): t=ultralytics/ultralytics:latest-jetson-jetpack6 && docker build --platform linux/arm64 -f docker/Dockerfile-jetson-jetpack6 -t $t .
# Example (push): docker push $t
# Example (pull): t=ultralytics/ultralytics:latest-jetson-jetpack6 && docker pull $t
# Example (run): docker run -it --ipc=host --runtime=nvidia $t
# Example (run-with-volume): docker run -it --ipc=host --runtime=nvidia -v "$PWD/shared/datasets:/datasets" $t

View file

@ -17,16 +17,11 @@ RUN uv pip install --system jupyterlab && \
# Start JupyterLab with tutorial notebook
ENTRYPOINT ["/usr/local/bin/jupyter", "lab", "--allow-root", "--ip=0.0.0.0", "/ultralytics/examples/tutorial.ipynb"]
# Usage Examples -------------------------------------------------------------------------------------------------------
# Usage --------------------------------------------------------------------------------------------------------------
# Build and Push
# t=ultralytics/ultralytics:latest-jupyter && sudo docker build -f docker/Dockerfile-jupyter -t $t . && sudo docker push $t
# Run
# t=ultralytics/ultralytics:latest-jupyter && sudo docker run -it --ipc=host -p 8888:8888 $t
# Pull and Run
# t=ultralytics/ultralytics:latest-jupyter && sudo docker pull $t && sudo docker run -it --ipc=host -p 8888:8888 $t
# Pull and Run with local volume mounted
# t=ultralytics/ultralytics:latest-jupyter && sudo docker pull $t && sudo docker run -it --ipc=host -p 8888:8888 -v "$(pwd)"/datasets:/data/datasets $t
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
# Example (build): t=ultralytics/ultralytics:latest-jupyter && docker build -f docker/Dockerfile-jupyter -t $t .
# Example (push): docker push $t
# Example (pull): t=ultralytics/ultralytics:latest-jupyter && docker pull $t
# Example (run): docker run -it --ipc=host -p 8888:8888 $t
# Example (run-with-volume): docker run -it --ipc=host -p 8888:8888 -v "$PWD/datasets:/data/datasets" $t

View file

@ -39,16 +39,11 @@ RUN pip install uv && \
# Remove extra build files
rm -rf tmp ~/.cache /root/.config/Ultralytics/persistent_cache.json
# Usage Examples -------------------------------------------------------------------------------------------------------
# Usage --------------------------------------------------------------------------------------------------------------
# Build and Push
# t=ultralytics/ultralytics:latest-python && sudo docker build -f docker/Dockerfile-python -t $t . && sudo docker push $t
# Run
# t=ultralytics/ultralytics:latest-python && sudo docker run -it --ipc=host $t
# Pull and Run
# t=ultralytics/ultralytics:latest-python && sudo docker pull $t && sudo docker run -it --ipc=host $t
# Pull and Run with local volume mounted
# t=ultralytics/ultralytics:latest-python && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/datasets $t
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
# Example (build): t=ultralytics/ultralytics:latest-python && docker build -f docker/Dockerfile-python -t $t .
# Example (push): docker push $t
# Example (pull): t=ultralytics/ultralytics:latest-python && docker pull $t
# Example (run): docker run -it --ipc=host $t
# Example (run-with-volume): docker run -it --ipc=host -v "$PWD/shared/datasets:/datasets" $t

View file

@ -24,16 +24,11 @@ RUN uv pip install --system -e ".[export]" && \
# Remove extra build files
rm -rf tmp /root/.config/Ultralytics/persistent_cache.json
# Usage Examples -------------------------------------------------------------------------------------------------------
# Usage --------------------------------------------------------------------------------------------------------------
# Build and Push
# t=ultralytics/ultralytics:latest-python-export && sudo docker build -f docker/Dockerfile-python-export -t $t . && sudo docker push $t
# Run
# t=ultralytics/ultralytics:latest-python-export && sudo docker run -it --ipc=host $t
# Pull and Run
# t=ultralytics/ultralytics:latest-python-export && sudo docker pull $t && sudo docker run -it --ipc=host $t
# Pull and Run with local volume mounted
# t=ultralytics/ultralytics:latest-python-export && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/datasets $t
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
# Example (build): t=ultralytics/ultralytics:latest-python-export && docker build -f docker/Dockerfile-python-export -t $t .
# Example (push): docker push $t
# Example (pull): t=ultralytics/ultralytics:latest-python-export && docker pull $t
# Example (run): docker run -it --ipc=host $t
# Example (run-with-volume): docker run -it --ipc=host -v "$PWD/shared/datasets:/datasets" $t

View file

@ -30,10 +30,10 @@ RUN FILENAME=actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz && \
# JSON ENTRYPOINT command to configure and start runner with default TOKEN and NAME
ENTRYPOINT ["sh", "-c", "./config.sh --url https://github.com/ultralytics/ultralytics --token ${GITHUB_RUNNER_TOKEN:-TOKEN} --name ${GITHUB_RUNNER_NAME:-NAME} --labels gpu-latest --replace && ./run.sh"]
# Usage Examples -------------------------------------------------------------------------------------------------------
# Usage --------------------------------------------------------------------------------------------------------------
# Build and Push
# t=ultralytics/ultralytics:latest-runner && sudo docker build -f docker/Dockerfile-runner -t $t . && sudo docker push $t
# Pull and Run in detached mode with access to GPUs 0 and 1
# t=ultralytics/ultralytics:latest-runner && sudo docker run -d -e GITHUB_RUNNER_TOKEN=TOKEN -e GITHUB_RUNNER_NAME=NAME --ipc=host --runtime=nvidia --gpus '"device=0,1"' $t
# Production builds: https://github.com/ultralytics/ultralytics/blob/main/.github/workflows/docker.yml
# Example (build): t=ultralytics/ultralytics:latest-runner && docker build -f docker/Dockerfile-runner -t $t .
# Example (push): docker push $t
# Example (pull): t=ultralytics/ultralytics:latest-runner && docker pull $t
# Example (run): docker run -d --restart unless-stopped -e GITHUB_RUNNER_TOKEN=TOKEN -e GITHUB_RUNNER_NAME=NAME --ipc=host --runtime=nvidia --gpus all $t