-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
57 lines (51 loc) · 1.62 KB
/
docker-compose.yml
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
version: "3.9"
services:
project:
container_name: ${PROJECT}_${USER_NAME}
runtime: nvidia
build:
context: docker/
dockerfile: Dockerfile
args:
- USER_ID=${UID}
- GROUP_ID=${GID}
- USER_NAME=${USER_NAME}
- http_proxy=${http_proxy}
- https_proxy=${https_proxy}
image: ${PROJECT}:${USER_NAME}
environment:
- TZ=Asia/Shanghai
- TORCH_HOME=/data/torch_model
- HF_HOME=/data/pretrain/transformers
- CLIP_CACHE=/data/pretrain/clip
- DISPLAY=${DISPLAY}
# change hostname to docker
hostname: docker
extra_hosts:
docker: 127.0.0.1
# Use the host system’s IPC namespace.
# https://docs.docker.com/engine/reference/run/#ipc-settings---ipc
ipc: host
# Use the host's network stack inside the container.
# (directly mapping ports in container to host)
# https://docs.docker.com/engine/reference/run/#network-settings
network_mode: host
working_dir: /project
# command: ["sleep", "infinity"]
command: >
bash -c
"sudo rsync -a --stats --chown=${USER_NAME}:${USER_NAME} --ignore-existing
/${USER_NAME}_home_bak/ ${TARGET_HOME}
&& . ${TARGET_HOME}/.bashrc
&& sleep infinity"
# mount the <directory in host> to the <directory in container>
# add more mounts here if you need
volumes:
- /var/run/docker.sock:/var/run/docker.sock # run docker in docker
- ${CODE_ROOT}:/project
- ${DATA_ROOT}:/data
- ${LOG_ROOT}:/log
- type: bind
source: ${CONTAINER_HOME}
target: ${TARGET_HOME}
- /tmp/.X11-unix:/tmp/.X11-unix