Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

Dockerfile 3.8 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
  1. # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
  2. # Builds ultralytics/ultralytics:latest image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
  3. # Image is CUDA-optimized for YOLO11 single/multi-GPU training and inference
  4. # Start FROM PyTorch image https://hub.docker.com/r/pytorch/pytorch or nvcr.io/nvidia/pytorch:25.02-py3
  5. FROM pytorch/pytorch:2.6.0-cuda12.6-cudnn9-runtime
  6. # Set environment variables
  7. # Avoid DDP error "MKL_THREADING_LAYER=INTEL is incompatible with libgomp.so.1 library" https://github.com/pytorch/pytorch/issues/37377
  8. # Suppress TensorFlow cuDNN, cuBLAS, and cuFFT Registration Warnings
  9. ENV PYTHONUNBUFFERED=1 \
  10. PYTHONDONTWRITEBYTECODE=1 \
  11. PIP_NO_CACHE_DIR=1 \
  12. PIP_BREAK_SYSTEM_PACKAGES=1 \
  13. MKL_THREADING_LAYER=GNU \
  14. OMP_NUM_THREADS=1 \
  15. TF_CPP_MIN_LOG_LEVEL=3
  16. # Downloads to user config dir
  17. ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
  18. https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
  19. /root/.config/Ultralytics/
  20. # Install linux packages
  21. # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
  22. # libsm6 required by libqxcb to create QT-based windows for visualization; set 'QT_DEBUG_PLUGINS=1' to test in docker
  23. RUN apt-get update && \
  24. apt-get install -y --no-install-recommends \
  25. gcc git zip unzip wget curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0 libsm6 \
  26. && rm -rf /var/lib/apt/lists/*
  27. # Security updates
  28. # https://security.snyk.io/vuln/SNYK-UBUNTU1804-OPENSSL-3314796
  29. RUN apt upgrade --no-install-recommends -y openssl tar
  30. # Create working directory
  31. WORKDIR /ultralytics
  32. # Copy contents and configure git
  33. COPY . .
  34. RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
  35. ADD https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n.pt .
  36. # Install pip packages
  37. RUN pip install uv
  38. RUN uv pip install --system -e ".[export]" albumentations pycocotools "onnxruntime-gpu" tensorrt wandb
  39. # Run exports to AutoInstall packages
  40. # Edge TPU export fails the first time so is run twice here
  41. RUN yolo export model=tmp/yolo11n.pt format=edgetpu imgsz=32 || yolo export model=tmp/yolo11n.pt format=edgetpu imgsz=32
  42. RUN yolo export model=tmp/yolo11n.pt format=ncnn imgsz=32
  43. RUN uv pip install --system paddlepaddle x2paddle
  44. # Remove extra build files
  45. RUN rm -rf tmp /root/.config/Ultralytics/persistent_cache.json
  46. # Usage Examples -------------------------------------------------------------------------------------------------------
  47. # Build and Push
  48. # t=ultralytics/ultralytics:latest && sudo docker build -f docker/Dockerfile -t $t . && sudo docker push $t
  49. # Pull and Run with access to all GPUs
  50. # t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all $t
  51. # Pull and Run with access to GPUs 2 and 3 (inside container CUDA devices will appear as 0 and 1)
  52. # t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus '"device=2,3"' $t
  53. # Pull and Run with local directory access
  54. # t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all -v "$(pwd)"/shared/datasets:/datasets $t
  55. # Kill all
  56. # sudo docker kill $(sudo docker ps -q)
  57. # Kill all image-based
  58. # sudo docker kill $(sudo docker ps -qa --filter ancestor=ultralytics/ultralytics:latest)
  59. # DockerHub tag update
  60. # t=ultralytics/ultralytics:latest tnew=ultralytics/ultralytics:v6.2 && sudo docker pull $t && sudo docker tag $t $tnew && sudo docker push $tnew
  61. # Clean up
  62. # sudo docker system prune -a --volumes
  63. # Update Ubuntu drivers
  64. # https://www.maketecheasier.com/install-nvidia-drivers-ubuntu/
  65. # DDP test
  66. # python -m torch.distributed.run --nproc_per_node 2 --master_port 1 train.py --epochs 3
  67. # GCP VM from Image
  68. # docker.io/ultralytics/ultralytics:latest
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...