-
Notifications
You must be signed in to change notification settings - Fork 7
/
_run.sh
60 lines (38 loc) · 1.3 KB
/
_run.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
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
#!/bin/bash
# Make sure to add the following entry in /etc/default/grub:
#GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
# Name
NAME="rstudio-server"
# CPU options
#CPU_SHARES="--cpu-shares=8"
#CPU_SETS="--cpuset-cpus=0-$[$CPU_SHARES-1]"
#CPU_MEMS="--cpuset-mems=0"
#MEM="--memory=24g"
# Ports
PORT_PUB=9000
PORT_DOCKER=8080
# Volumes
VOL="--volume=/home:/home:rw --volume=/mnt:/mnt:ro"
# Run docker
docker run --publish=${PORT_PUB}:${PORT_DOCKER} --log-driver=syslog $VOL $CPU_SHARES $CPU_SETS $CPU_MEMS $MEM --name="${NAME}-run" -i -t -d $NAME
# Detach/Attach docker
# detach: CTRL-P + CTRL-Q
# Start and attach docker (you can also use docker start -ai instead)
#docker start ${NAME}-run
#docker attach ${NAME}-run
# Start shell inside running docker
#docker exec -i -t ${NAME}-run /bin/bash
# Start failed container with different entrypoint
#docker run -ti --entrypoint=/bin/bash ${NAME}-run
# Commit changes locally
#docker commit ${NAME}-run
# Show docker container and images
#docker ps -a
#docker images
# Delete container and image
#docker rm ${NAME}-run
#docker rmi ${NAME}
# Delete exited containers
#docker rm $(docker ps -a -f status=exited | grep -v CONTAINER\ ID | awk '{print $1}')
# Delete intermediate/untagged images
#docker rmi $(docker images | grep '^<none>' | awk '{print $3}')