-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.ultralytics
44 lines (31 loc) · 1.74 KB
/
Dockerfile.ultralytics
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
# Image is CUDA-optimized for YOLOv8 single/multi-GPU training and inference
# Start FROM PyTorch image https://hub.docker.com/r/pytorch/pytorch or nvcr.io/nvidia/pytorch:23.03-py3
FROM pytorch/pytorch:2.2.2-cuda12.1-cudnn8-runtime
RUN pip install --no-cache nvidia-tensorrt --index-url https://pypi.ngc.nvidia.com
# ENV DEBIAN_FRONTEND=noninteractive
# Downloads to user config dir
ADD assets/Arial.ttf assets/Arial.Unicode.ttf /root/.config/Ultralytics/
RUN /bin/bash -c 'conda init bash'
# 将原镜像地址替换为腾讯云镜像地址
RUN sed -i 's/archive.ubuntu.com/mirrors.cloud.tencent.com/g' /etc/apt/sources.list
RUN sed -i 's/security.ubuntu.com/mirrors.cloud.tencent.com/g' /etc/apt/sources.list
RUN apt update && \
apt install --no-install-recommends -y build-essential \
gcc git zip curl htop libgl1 libglib2.0-0 libpython3-dev gnupg g++ \
libusb-1.0-0 && apt clean && \
apt autoremove && \
rm -rf /var/lib/apt/lists/*
RUN apt upgrade --no-install-recommends -y openssl tar
# RUN mkdir -p /home/user/ultralytics
WORKDIR /home/user/ultralytics
ADD requirements.txt /home/user/ultralytics
# 换源并更新pip
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple/
RUN pip install --upgrade pip
# RUN pip install --no-cache -e ".[export]" albumentations comet pycocotools
RUN pip install --no-cache -r requirements.txt
# Usage Examples -------------------------------------------------------------------------------------------------------
# build
# docker build --pull --rm -f "Dockerfile.ultralytics" -t ultralytics:2.2.2-cuda12.1-cudnn8-runtime "."
# run
# docker run --rm --gpus all -it -v E:\Projects\weights\yolo\v8\detect\coco:/home/user/ultralytics -p : --name yolo ultralytics:2.2.2-cuda12.1-cudnn8-runtime