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.3 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
  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 YOLO 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.8.0-cuda12.8-cudnn9-runtime
  6. # Set environment variables
  7. # Avoid DDP error "MKL_THREADING_LAYER=INTEL is incompatible with libgomp.so.1 library"
  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. # gnupg required for Edge TPU install
  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 gnupg libsm6 && \
  26. apt-get clean && \
  27. rm -rf /var/lib/apt/lists/*
  28. # Create working directory
  29. WORKDIR /ultralytics
  30. # Copy contents and configure git
  31. COPY . .
  32. RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config && \
  33. sed -i'' -e 's/"opencv-python/"opencv-python-headless/' pyproject.toml
  34. ADD https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n.pt .
  35. # Install pip packages
  36. RUN pip install uv && \
  37. uv pip install --system -e "." albumentations faster-coco-eval wandb && \
  38. # Remove extra build files \
  39. rm -rf tmp /root/.config/Ultralytics/persistent_cache.json
  40. # Usage Examples -------------------------------------------------------------------------------------------------------
  41. # Build and Push
  42. # t=ultralytics/ultralytics:latest && sudo docker build -f docker/Dockerfile -t $t . && sudo docker push $t
  43. # Pull and Run with access to all GPUs
  44. # t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all $t
  45. # Pull and Run with access to GPUs 2 and 3 (inside container CUDA devices will appear as 0 and 1)
  46. # t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus '"device=2,3"' $t
  47. # Pull and Run with local directory access
  48. # t=ultralytics/ultralytics:latest && sudo docker pull $t && sudo docker run -it --ipc=host --gpus all -v "$(pwd)"/shared/datasets:/datasets $t
  49. # Kill all
  50. # sudo docker kill $(sudo docker ps -q)
  51. # Kill all image-based
  52. # sudo docker kill $(sudo docker ps -qa --filter ancestor=ultralytics/ultralytics:latest)
  53. # DockerHub tag update
  54. # t=ultralytics/ultralytics:latest tnew=ultralytics/ultralytics:v6.2 && sudo docker pull $t && sudo docker tag $t $tnew && sudo docker push $tnew
  55. # Clean up
  56. # sudo docker system prune -a --volumes
  57. # Update Ubuntu drivers
  58. # https://www.maketecheasier.com/install-nvidia-drivers-ubuntu/
  59. # DDP test
  60. # python -m torch.distributed.run --nproc_per_node 2 --master_port 1 train.py --epochs 3
  61. # GCP VM from Image
  62. # docker.io/ultralytics/ultralytics:latest
Tip!

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

Comments

Loading...