Dockerfile-conda 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Ultralytics YOLO 🚀, AGPL-3.0 license
  2. # Builds ultralytics/ultralytics:latest-conda image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
  3. # Image is optimized for Ultralytics Anaconda (https://anaconda.org/conda-forge/ultralytics) installation and usage
  4. # Start FROM miniconda3 image https://hub.docker.com/r/continuumio/miniconda3
  5. FROM continuumio/miniconda3:latest
  6. # Downloads to user config dir
  7. ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
  8. https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \
  9. /root/.config/Ultralytics/
  10. # Install linux packages
  11. RUN apt update \
  12. && apt install --no-install-recommends -y libgl1
  13. # Copy contents
  14. ADD https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt .
  15. # Install conda packages
  16. # mkl required to fix 'OSError: libmkl_intel_lp64.so.2: cannot open shared object file: No such file or directory'
  17. RUN conda config --set solver libmamba && \
  18. conda install pytorch torchvision pytorch-cuda=12.1 -c pytorch -c nvidia && \
  19. conda install -c conda-forge ultralytics mkl
  20. # conda install -c pytorch -c nvidia -c conda-forge pytorch torchvision pytorch-cuda=12.1 ultralytics mkl
  21. # Usage Examples -------------------------------------------------------------------------------------------------------
  22. # Build and Push
  23. # t=ultralytics/ultralytics:latest-conda && sudo docker build -f docker/Dockerfile-cpu -t $t . && sudo docker push $t
  24. # Run
  25. # t=ultralytics/ultralytics:latest-conda && sudo docker run -it --ipc=host $t
  26. # Pull and Run
  27. # t=ultralytics/ultralytics:latest-conda && sudo docker pull $t && sudo docker run -it --ipc=host $t
  28. # Pull and Run with local volume mounted
  29. # t=ultralytics/ultralytics:latest-conda && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/usr/src/datasets $t