-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_docker.sh
executable file
·32 lines (28 loc) · 997 Bytes
/
run_docker.sh
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
# http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/
# https://stackoverflow.com/a/28971413
# assumes that image was built with command:
# docker build -t robosuite .
DOCKER_NAME=${USER}-robosuite
# stop and remove any already running containers
EXISTING_DOCKER_CONTAINER_ID=`docker ps -aq -f name=${DOCKER_NAME}`
if [ ! -z "${EXISTING_DOCKER_CONTAINER_ID}" ]; then
docker stop ${EXISTING_DOCKER_CONTAINER_ID}
docker rm ${EXISTING_DOCKER_CONTAINER_ID}
fi
# sharing git authentication to docker containiner:
# https://embeddeduse.com/2023/03/20/accessing-private-git-repositories-from-docker-containers/
docker run \
-it \
-d \
--gpus all \
-e DISPLAY=$DISPLAY \
-e "USER_ID=$(id -u)" \
-e GROUP_ID="$(id -g)" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v "${HOME}/.ssh:/home/builder/.ssh:rw" \
-v "${SSH_AUTH_SOCK}:/ssh.socket" -e "SSH_AUTH_SOCK=/ssh.socket" \
--mount type=bind,source=$(pwd),target=/srv \
--shm-size=1024m \
--name ${DOCKER_NAME} \
robosuite \
bash