forked from jpetazzo/dockerfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashrc
More file actions
31 lines (31 loc) · 858 Bytes
/
bashrc
File metadata and controls
31 lines (31 loc) · 858 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
command_not_found_handle () {
# Check if there is a container image with that name
if ! docker inspect --format '{{ .Author }}' "$1" >&/dev/null
then
echo "$0: $1: command not found"
return
fi
# Check that it's really the name of the image, not a prefix
if docker inspect --format '{{ .Id }}' "$1" | grep -q "^$1"
then
echo "$0: $1: command not found"
return
fi
# If we are somewhere within our home, go there.
if echo $PWD | grep -q ^/home
then
WORKDIR=$PWD
else
WORKDIR=/home
fi
docker run -it -P -u $(whoami) -w "$WORKDIR" \
$(env | cut -d= -f1 | awk '{print "-e", $1}') \
--device /dev/kvm:/dev/kvm \
-v /dev/snd:/dev/snd \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/group:/etc/group:ro \
-v /etc/localtime:/etc/localtime:ro \
-v /home:/home \
-v /tmp/.X11-unix:/tmp/.X11-unix \
"$@"
}