-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathrun_docker.sh
More file actions
executable file
·36 lines (29 loc) · 956 Bytes
/
run_docker.sh
File metadata and controls
executable file
·36 lines (29 loc) · 956 Bytes
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
#!/usr/bin/env bash
#
# Runs the lab environment in docker.
#
IMAGE=${IMAGE:-greatscottgadgets/hacking-usb}
COMMAND="${@:-bash}"
if [ -z $DISPLAY ]; then
docker run -it --privileged \
--env="DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--volume="$(pwd):/work" \
--device="/dev/usbmon*" \
${IMAGE} \
${COMMAND}
else
# Grant access to the container's image, so the container can access local resources.
CONTAINER_ID=$(docker ps -l -q)
xhost +local:`docker inspect --format='{{ .Config.Hostname }}' ${CONTAINER_ID}`
# Run our docker instance with access to the host display socket.
docker run -it --privileged \
--env="DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--volume="$(pwd):/work" \
--device="/dev/usbmon*" \
${IMAGE} \
${COMMAND}
fi;