Một số note về docker

Posted by Hao Do on June 19, 2023

Một số note về docker

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
File requirements.txt

torch @ https://download.pytorch.org/whl/cu118/torch-2.0.1%2Bcu118-cp310-cp310-linux_x86_64.whl#sha256=a7a49d459bf4862f64f7bc1a68beccf8881c2fa9f3e0569608e16ba6f85ebf7b
torchaudio @ https://download.pytorch.org/whl/cu118/torchaudio-2.0.2%2Bcu118-cp310-cp310-linux_x86_64.whl#sha256=26692645ea061a005c57ec581a2d0425210ac6ba9f923edf11cc9b0ef3a111e9
torchdata==0.6.1
torchsummary==1.5.1
torchtext==0.15.2
torchvision @ https://download.pytorch.org/whl/cu118/torchvision-0.15.2%2Bcu118-cp310-cp310-linux_x86_64.whl#sha256=19ca4ab5d6179bbe53cff79df1a855ee6533c2861ddc7389f68349d8b9f8302a
ultralytics==8.0.20
opencv-contrib-python==4.7.0.72
opencv-python==4.7.0.72
opencv-python-headless==4.7.0.72

docker image tag 'imagetag' ai_contest
docker image tag "imagetag" haodophuc/ai_contest

docker run -it haodophuc/haodo_ai bash

import ultralytics
from IPython import display
from ultralytics import YOLO
from IPython.display import display, Image
import cv2
import os

docker image push haodophuc/ai_contest

Dockerfile
RUN mkdir -p /path/to/your/writable/directory
ENV TMPDIR=/path/to/your/writable/directory

docker login

find -type f -size +2G

docker pull ultralytics/ultralytics:latest

find  /folder -type f -size +2G

docker rmi -f myimage

RUN apt-get update && apt-get install -y \
    libsm6 \
    libxext6 \
    libxrender1 \
    libglib2.0-0 \
    libgl1-mesa-glx

image haodophuc/ai_contest:latest

check permission của file

ls -l file

Dockerfile
FROM keleas/s1_test_env:latest

RUN mkdir -p /app

RUN chmod -R 777 /app

ENV TMPDIR =/app

WORKDIR /app

COPY requirements.txt .

RUN apt-get update && apt-get install -y \
    libsm6 \
    libxext6 \
    libxrender1 \
    libglib2.0-0 \
    libgl1-mesa-glx \
    vim

RUN pip install -r requirements.txt

Để build docker
docker build .

Tài liệu tham khảo

AI Việt Nam

Hết.