-
Notifications
You must be signed in to change notification settings - Fork 0
/
.dockerfunc
994 lines (907 loc) · 21.9 KB
/
.dockerfunc
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
#!/bin/bash
# Bash wrappers for docker run commands
export DOCKER_REPO_PREFIX=jess
#
# Helper Functions
#
dcleanup(){
docker rm $(docker ps -aq 2>/dev/null) 2>/dev/null
docker rm -v $(docker ps --filter status=exited -q 2>/dev/null) 2>/dev/null
docker rmi $(docker images --filter dangling=true -q 2>/dev/null) 2>/dev/null
}
del_stopped(){
local name=$1
local state=$(docker inspect --format "{{.State.Running}}" $name 2>/dev/null)
if [[ "$state" == "false" ]]; then
docker rm $name
fi
}
relies_on(){
local containers=$@
for container in $containers; do
local state=$(docker inspect --format "{{.State.Running}}" $container 2>/dev/null)
if [[ "$state" == "false" ]] || [[ "$state" == "" ]]; then
echo "$container is not running, starting it for you."
$container
fi
done
}
# creates an nginx config for a local route
nginx_config(){
server=$1
route=$2
cat >${HOME}/.nginx/conf.d/${server}.conf <<-EOF
upstream ${server} { server ${route}; }
server {
server_name ${server};
location / {
proxy_pass http://${server};
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_set_header X-Forwarded-For \$remote_addr;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Request-Start \$msec;
}
}
EOF
# restart nginx
docker restart nginx
# add host to /etc/hosts
sudo hostess add $server 127.0.0.1
# open browser
browser-exec "http://${server}"
}
#
# Container Aliases
#
apt_file(){
docker run --rm -it \
--name apt-file \
${DOCKER_REPO_PREFIX}/apt-file
}
alias apt-file="apt_file"
audacity(){
del_stopped audacity
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-e QT_DEVICE_PIXEL_RATIO \
--device /dev/snd \
--group-add audio \
--name audacity \
${DOCKER_REPO_PREFIX}/audacity
}
aws(){
docker run -it --rm \
-v $HOME/.aws:/root/.aws \
--log-driver none \
--name aws \
${DOCKER_REPO_PREFIX}/awscli "$@"
}
bees(){
docker run -it --rm \
-e NOTARY_TOKEN \
-v $HOME/.bees:/root/.bees \
-v $HOME/.boto:/root/.boto \
-v $HOME/.dev:/root/.ssh:ro \
--log-driver none \
--name bees \
${DOCKER_REPO_PREFIX}/beeswithmachineguns "$@"
}
cadvisor(){
docker run -d \
--restart always \
-v /:/rootfs:ro \
-v /var/run:/var/run:rw \
-v /sys:/sys:ro \
-v /var/lib/docker/:/var/lib/docker:ro \
-p 1234:8080 \
--name cadvisor \
google/cadvisor
sudo hostess add cadvisor $(docker inspect --format "{{.NetworkSettings.Networks.bridge.IPAddress}}" cadvisor)
browser-exec "http://cadvisor:8080"
}
cheese(){
del_stopped cheese
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-v $HOME/Pictures:/root/Pictures \
--device /dev/video0 \
--device /dev/snd \
--device /dev/dri \
--name cheese \
${DOCKER_REPO_PREFIX}/cheese
}
chrome(){
# add flags for proxy if passed
local proxy=
local map=
local args=$@
if [[ "$1" == "tor" ]]; then
relies_on torproxy
map="MAP * ~NOTFOUND , EXCLUDE torproxy"
proxy="socks5://torproxy:9050"
args="https://check.torproject.org/api/ip ${@:2}"
fi
del_stopped chrome
# one day remove /etc/hosts bind mount when effing
# overlay support inotify, such bullshit
sudo docker run -d \
--memory 3gb \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-v $HOME/Downloads:/root/Downloads \
-v $HOME/Pictures:/root/Pictures \
-v $HOME/Torrents:/root/Torrents \
-v $HOME/.chrome:/data \
-v /dev/shm:/dev/shm \
-v /etc/hosts:/etc/hosts \
--security-opt seccomp:/etc/docker/seccomp/chrome.json \
--device /dev/snd \
--device /dev/dri \
--device /dev/video0 \
--device /dev/usb \
--device /dev/bus/usb \
--group-add audio \
--group-add video \
--name chrome \
${DOCKER_REPO_PREFIX}/chrome --user-data-dir=/data \
--proxy-server="$proxy" \
--host-resolver-rules="$map" $args
}
consul(){
del_stopped consul
# check if we passed args and if consul is running
local args=$@
local state=$(docker inspect --format "{{.State.Running}}" consul 2>/dev/null)
if [[ "$state" == "true" ]] && [[ ! -z "$args" ]]; then
docker exec -it consul consul "$@"
return 0
fi
docker run -d \
--restart always \
-v $HOME/.consul:/etc/consul.d \
-v /var/run/docker.sock:/var/run/docker.sock \
--net host \
-e GOMAXPROCS=2 \
--name consul \
${DOCKER_REPO_PREFIX}/consul agent \
-bootstrap-expect 1 \
-config-dir /etc/consul.d \
-data-dir /data \
-encrypt $(docker run --rm ${DOCKER_REPO_PREFIX}/consul keygen) \
-ui-dir /usr/src/consul \
-server \
-dc neverland \
-bind 0.0.0.0
sudo hostess add consul $(docker inspect --format "{{.NetworkSettings.Networks.bridge.IPAddress}}" consul)
browser-exec "http://consul:8500"
}
dcos(){
docker run -it --rm \
-v $HOME/.dcos:/root/.dcos \
-v $(pwd):/root/apps \
-w /root/apps \
${DOCKER_REPO_PREFIX}/dcos-cli "$@"
}
firefox(){
del_stopped firefox
docker run -d \
--memory 2gb \
--net host \
--cpuset-cpus 0 \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/.firefox/cache:/root/.cache/mozilla \
-v $HOME/.firefox/mozilla:/root/.mozilla \
-v $HOME/Downloads:/root/Downloads \
-v $HOME/Pictures:/root/Pictures \
-v $HOME/Torrents:/root/Torrents \
-e DISPLAY=unix$DISPLAY \
-e GDK_SCALE \
-e GDK_DPI_SCALE \
--device /dev/snd \
--device /dev/dri \
--name firefox \
${DOCKER_REPO_PREFIX}/firefox "$@"
# exit current shell
exit 0
}
gcalcli(){
docker run --rm -it \
-v /etc/localtime:/etc/localtime:ro \
-v $HOME/.gcalcli/home:/home/gcalcli/home \
-v $HOME/.gcalcli/work/oauth:/home/gcalcli/.gcalcli_oauth \
-v $HOME/.gcalcli/work/gcalclirc:/home/gcalcli/.gcalclirc \
--name gcalcli \
${DOCKER_REPO_PREFIX}/gcalcli "$@"
}
gcloud(){
docker run --rm -it \
-v $HOME/.gcloud:/root/.config/gcloud \
-v $HOME/.ssh:/root/.ssh:ro \
--name gcloud \
${DOCKER_REPO_PREFIX}/gcloud "$@"
}
gimp(){
del_stopped gimp
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-v $HOME/Pictures:/root/Pictures \
-v $HOME/.gtkrc:/root/.gtkrc \
-e GDK_SCALE \
-e GDK_DPI_SCALE \
--name gimp \
${DOCKER_REPO_PREFIX}/gimp
}
hollywood(){
docker run --rm -it \
--name hollywood \
${DOCKER_REPO_PREFIX}/hollywood
}
htop(){
docker run --rm -it \
--pid host \
--net none \
--name htop \
${DOCKER_REPO_PREFIX}/htop
}
http(){
docker run -t --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
--log-driver none \
${DOCKER_REPO_PREFIX}/httpie "$@"
}
imagemin(){
local image=$1
local extension="${image##*.}"
local filename="${image%.*}"
docker run --rm -it \
-v /etc/localtime:/etc/localtime:ro \
-v $HOME/Pictures:/root/Pictures \
${DOCKER_REPO_PREFIX}/imagemin sh -c "imagemin /root/Pictures/${image} > /root/Pictures/${filename}_min.${extension}"
}
irssi() {
del_stopped irssi
# relies_on notify_osd
docker run --rm -it \
-v /etc/localtime:/etc/localtime:ro \
-v $HOME/.irssi:/home/user/.irssi \
--read-only \
--name irssi \
${DOCKER_REPO_PREFIX}/irssi
}
john(){
local file=$(realpath $1)
docker run --rm -it \
-v ${file}:/root/$(basename ${file}) \
${DOCKER_REPO_PREFIX}/john $@
}
kernel_builder(){
docker run --rm -it \
-v /usr/src:/usr/src \
--cpu-shares=512 \
--name kernel-builder \
${DOCKER_REPO_PREFIX}/kernel-builder
}
kvm(){
del_stopped kvm
relies_on pulseaudio
# modprobe the module
sudo modprobe kvm
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /run/libvirt:/var/run/libvirt \
-e DISPLAY=unix$DISPLAY \
--link pulseaudio:pulseaudio \
-e PULSE_SERVER=pulseaudio \
--group-add audio \
--name kvm \
--privileged \
${DOCKER_REPO_PREFIX}/kvm
}
libreoffice(){
del_stopped libreoffice
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-v $HOME/slides:/root/slides \
-e GDK_SCALE \
-e GDK_DPI_SCALE \
--name libreoffice \
${DOCKER_REPO_PREFIX}/libreoffice
}
lpass(){
docker run --rm -it \
-v $HOME/.lpass:/root/.lpass \
--name lpass \
${DOCKER_REPO_PREFIX}/lpass "$@"
}
lynx(){
docker run --rm -it \
--name lynx \
${DOCKER_REPO_PREFIX}/lynx "$@"
}
masscan(){
docker run -it --rm \
--log-driver none \
--net host \
--cap-add NET_ADMIN \
--name masscan \
${DOCKER_REPO_PREFIX}/masscan "$@"
}
mpd(){
del_stopped mpd
# adding cap sys_admin so I can use nfs mount
# the container runs as a unpriviledged user mpd
docker run -d \
--device /dev/snd \
--cap-add SYS_ADMIN \
-e MPD_HOST=/var/lib/mpd/socket \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/exports:/etc/exports:ro \
-v $HOME/.mpd:/var/lib/mpd \
-v $HOME/.mpd.conf:/etc/mpd.conf \
--name mpd \
${DOCKER_REPO_PREFIX}/mpd
}
mutt(){
# subshell so we dont overwrite variables
(
local account=$1
export IMAP_SERVER=""
export SMTP_SERVER=""
if [[ "$account" == "riseup" ]]; then
GMAIL=$MAIL_RISEUP
GMAIL_NAME=$MAIL_RISEUP_NAME
GMAIL_PASS=$MAIL_RISEUP_PASS
GMAIL_FROM=$MAIL_RISEUP_FROM
IMAP_SERVER=mail.riseup.net
SMTP_SERVER=$IMAP_SERVER
fi
docker run -it --rm \
-e GMAIL \
-e GMAIL_NAME \
-e GMAIL_PASS \
-e GMAIL_FROM \
-e GPG_ID \
-e IMAP_SERVER \
-e SMTP_SERVER \
-v $HOME/.gnupg:/home/user/.gnupg:ro \
-v /etc/localtime:/etc/localtime:ro \
--name mutt${account} \
${DOCKER_REPO_PREFIX}/mutt
)
}
ncmpc(){
del_stopped ncmpc
docker run --rm -it \
-v $HOME/.mpd/socket:/var/run/mpd/socket \
-e MPD_HOST=/var/run/mpd/socket \
--name ncmpc \
${DOCKER_REPO_PREFIX}/ncmpc "$@"
}
neoman(){
del_stopped neoman
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
--device /dev/bus/usb \
--device /dev/usb \
--name neoman \
${DOCKER_REPO_PREFIX}/neoman
}
nes(){
del_stopped nes
local game=$1
docker run -d \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
--device /dev/dri \
--device /dev/snd \
--name nes \
${DOCKER_REPO_PREFIX}/nes /games/${game}.rom
}
netcat(){
docker run --rm -it \
--net host \
${DOCKER_REPO_PREFIX}/netcat "$@"
}
nginx(){
del_stopped nginx
docker run -d \
--restart always \
-v $HOME/.nginx:/etc/nginx \
--net host \
--name nginx \
nginx
# add domain to hosts & open nginx
sudo hostess add jess 127.0.0.1
}
nmap(){
docker run --rm -it \
--net host \
${DOCKER_REPO_PREFIX}/nmap "$@"
}
notify_osd(){
del_stopped notify_osd
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
--net none \
-v /etc \
-v /home/user/.dbus \
-v /home/user/.cache/dconf \
-e DISPLAY=unix$DISPLAY \
--name notify_osd \
${DOCKER_REPO_PREFIX}/notify-osd
}
alias notify-send=notify_send
notify_send(){
relies_on notify_osd
local args=${@:2}
docker exec -i notify_osd notify-send "$1" "${args}"
}
pandoc(){
local file=${@: -1}
local lfile=$(readlink -m "$(pwd)/${file}")
local rfile=$(readlink -m "/$(basename $file)")
local args=${@:1:${#@}-1}
docker run --rm \
-v ${lfile}:${rfile} \
-v /tmp:/tmp \
--name pandoc \
${DOCKER_REPO_PREFIX}/pandoc ${args} ${rfile}
}
pivman(){
del_stopped pivman
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
--device /dev/bus/usb \
--device /dev/usb \
--name pivman \
${DOCKER_REPO_PREFIX}/pivman
}
pms(){
del_stopped pms
docker run --rm -it \
-v $HOME/.mpd/socket:/var/run/mpd/socket \
-e MPD_HOST=/var/run/mpd/socket \
--name pms \
${DOCKER_REPO_PREFIX}/pms "$@"
}
pond(){
del_stopped pond
relies_on torproxy
docker run --rm -it \
--net container:torproxy \
--name pond \
${DOCKER_REPO_PREFIX}/pond
}
privoxy(){
del_stopped privoxy
relies_on torproxy
docker run -d \
--restart always \
--link torproxy:torproxy \
-v /etc/localtime:/etc/localtime:ro \
-p 8118:8118 \
--name privoxy \
${DOCKER_REPO_PREFIX}/privoxy
sudo hostess add privoxy $(docker inspect --format "{{.NetworkSettings.Networks.bridge.IPAddress}}" privoxy)
}
pulseaudio(){
del_stopped pulseaudio
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
--device /dev/snd \
-p 4713:4713 \
--restart always \
--group-add audio \
--name pulseaudio \
${DOCKER_REPO_PREFIX}/pulseaudio
}
radare2() {
docker run -it --rm \
-v /etc/localtime:/etc/localtime:ro \
-v $HOME/.config/radare2:/root/.config/radare2 \
-v $PWD:/app \
--workdir /app \
radare/radare2 /bin/bash
}
rainbowstream(){
docker run -it --rm \
-v /etc/localtime:/etc/localtime:ro \
-v $HOME/.rainbow_oauth:/root/.rainbow_oauth \
-v $HOME/.rainbow_config.json:/root/.rainbow_config.json \
--name rainbowstream \
${DOCKER_REPO_PREFIX}/rainbowstream
}
registrator(){
del_stopped registrator
docker run -d --restart always \
-v /var/run/docker.sock:/tmp/docker.sock \
--net host \
--name registrator \
gliderlabs/registrator consul:
}
remmina(){
del_stopped remmina
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-e GDK_SCALE \
-e GDK_DPI_SCALE \
-v $HOME/.remmina:/root/.remmina \
--name remmina \
--net host \
${DOCKER_REPO_PREFIX}/remmina
}
ricochet(){
del_stopped ricochet
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-e GDK_SCALE \
-e GDK_DPI_SCALE \
-e QT_DEVICE_PIXEL_RATIO \
--device /dev/dri \
--name ricochet \
${DOCKER_REPO_PREFIX}/ricochet
}
rstudio(){
del_stopped rstudio
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/fastly-logs:/root/fastly-logs \
-v /dev/shm:/dev/shm \
-e DISPLAY=unix$DISPLAY \
-e QT_DEVICE_PIXEL_RATIO \
--device /dev/dri \
--name rstudio \
${DOCKER_REPO_PREFIX}/rstudio
}
s3cmdocker(){
del_stopped s3cmd
docker run --rm -it \
-e AWS_ACCESS_KEY="${DOCKER_AWS_ACCESS_KEY}" \
-e AWS_SECRET_KEY="${DOCKER_AWS_ACCESS_SECRET}" \
-v $(pwd):/root/s3cmd-workspace \
--name s3cmd \
${DOCKER_REPO_PREFIX}/s3cmd "$@"
}
scudcloud(){
del_stopped scudcloud
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-v /etc/machine-id:/etc/machine-id:ro \
-v /var/run/dbus:/var/run/dbus \
-v /var/run/user/$(id -u):/var/run/user/$(id -u) \
-e TERM \
-e XAUTHORITY \
-e DBUS_SESSION_BUS_ADDRESS \
-e HOME \
-e QT_DEVICE_PIXEL_RATIO \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/group:/etc/group:ro \
-u $(whoami) -w "$HOME" \
-v $HOME/.Xauthority:$HOME/.Xauthority \
-v /etc/machine-id:/etc/machine-id:ro \
-v $HOME/.scudcloud:/home/jessie/.config/scudcloud \
--device /dev/snd \
--name scudcloud \
${DOCKER_REPO_PREFIX}/scudcloud
# exit current shell
exit 0
}
shorewall(){
del_stopped shorewall
docker run --rm -it \
--net host \
--cap-add NET_ADMIN \
--privileged \
--name shorewall \
${DOCKER_REPO_PREFIX}/shorewall "$@"
}
skype(){
del_stopped skype
relies_on pulseaudio
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
--link pulseaudio:pulseaudio \
-e PULSE_SERVER=pulseaudio \
--security-opt seccomp:unconfined \
--device /dev/video0 \
--group-add video \
--group-add audio \
--name skype \
${DOCKER_REPO_PREFIX}/skype
}
slack(){
del_stopped slack
sudo docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
--device /dev/snd \
--device /dev/dri \
--device /dev/video0 \
--group-add audio \
--group-add video \
-v /home/jessie/.slack:/root/.config/Slack \
--name slack \
${DOCKER_REPO_PREFIX}/slack
}
spotify(){
del_stopped spotify
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-e QT_DEVICE_PIXEL_RATIO \
--security-opt seccomp:unconfined \
--device /dev/snd \
--device /dev/dri \
--group-add audio \
--group-add video \
--name spotify \
${DOCKER_REPO_PREFIX}/spotify
}
ssh2john(){
local file=$(realpath $1)
docker run --rm -it \
-v ${file}:/root/$(basename ${file}) \
--entrypoint ssh2john \
${DOCKER_REPO_PREFIX}/john $@
}
steam(){
del_stopped steam
relies_on pulseaudio
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/machine-id:/etc/machine-id:ro \
-v /var/run/dbus:/var/run/dbus \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/.steam:/home/steam \
-e DISPLAY=unix$DISPLAY \
--link pulseaudio:pulseaudio \
-e PULSE_SERVER=pulseaudio \
--device /dev/dri \
--name steam \
${DOCKER_REPO_PREFIX}/steam
}
t(){
docker run -t --rm \
-v $HOME/.trc:/root/.trc \
--log-driver none \
${DOCKER_REPO_PREFIX}/t "$@"
}
tarsnap(){
docker run --rm -it \
-v $HOME/.tarsnaprc:/root/.tarsnaprc \
-v $HOME/.tarsnap:/root/.tarsnap \
-v $HOME:/root/workdir \
${DOCKER_REPO_PREFIX}/tarsnap "$@"
}
telnet(){
docker run -it --rm \
--log-driver none \
${DOCKER_REPO_PREFIX}/telnet "$@"
}
termboy(){
del_stopped termboy
local game=$1
docker run --rm -it \
--device /dev/snd \
--name termboy \
${DOCKER_REPO_PREFIX}/nes /games/${game}.rom
}
tor(){
del_stopped tor
docker run -d \
--net host \
--name tor \
${DOCKER_REPO_PREFIX}/tor
# set up the redirect iptables rules
sudo setup-tor-iptables
# validate we are running through tor
browser-exec "https://check.torproject.org/"
}
torbrowser(){
del_stopped torbrowser
mkdir -p /tmp/tor
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /tmp/tor \
-e DISPLAY=unix$DISPLAY \
-e GDK_SCALE \
-e GDK_DPI_SCALE \
--device /dev/snd \
--name torbrowser \
${DOCKER_REPO_PREFIX}/tor-browser
# exit current shell
exit 0
}
tormessenger(){
del_stopped tormessenger
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-e GDK_SCALE \
-e GDK_DPI_SCALE \
--device /dev/snd \
--name tormessenger \
${DOCKER_REPO_PREFIX}/tor-messenger
# exit current shell
exit 0
}
torproxy(){
del_stopped torproxy
docker run -d \
--restart always \
-v /etc/localtime:/etc/localtime:ro \
-p 9050:9050 \
--name torproxy \
${DOCKER_REPO_PREFIX}/tor-proxy
sudo hostess add torproxy $(docker inspect --format "{{.NetworkSettings.Networks.bridge.IPAddress}}" torproxy)
}
traceroute(){
docker run --rm -it \
--net host \
${DOCKER_REPO_PREFIX}/traceroute "$@"
}
transmission(){
del_stopped transmission
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v $HOME/Torrents:/transmission/download \
-v $HOME/.transmission:/transmission/config \
-p 9091:9091 \
-p 51413:51413 \
-p 51413:51413/udp \
--name transmission \
${DOCKER_REPO_PREFIX}/transmission
sudo hostess add transmission $(docker inspect --format "{{.NetworkSettings.Networks.bridge.IPAddress}}" transmission)
browser-exec "http://transmission:9091"
}
virsh(){
relies_on kvm
docker run -it --rm \
-v /etc/localtime:/etc/localtime:ro \
-v /run/libvirt:/var/run/libvirt \
--log-driver none \
--net container:kvm \
${DOCKER_REPO_PREFIX}/libvirt-client "$@"
}
virt_viewer(){
relies_on kvm
docker run -it --rm \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-v /run/libvirt:/var/run/libvirt \
-e PULSE_SERVER=pulseaudio \
--group-add audio \
--log-driver none \
--net container:kvm \
${DOCKER_REPO_PREFIX}/virt-viewer "$@"
}
alias virt-viewer="virt_viewer"
visualstudio(){
del_stopped visualstudio
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
--name visualstudio \
${DOCKER_REPO_PREFIX}/visualstudio
}
vlc(){
del_stopped vlc
relies_on pulseaudio
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-e GDK_SCALE \
-e GDK_DPI_SCALE \
-e QT_DEVICE_PIXEL_RATIO \
--link pulseaudio:pulseaudio \
-e PULSE_SERVER=pulseaudio \
--group-add audio \
--group-add video \
-v $HOME/Torrents:/home/vlc/Torrents \
--device /dev/dri \
--name vlc \
${DOCKER_REPO_PREFIX}/vlc
}
watchman(){
del_stopped watchman
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v $HOME/Downloads:/root/Downloads \
--name watchman \
${DOCKER_REPO_PREFIX}/watchman --foreground
}
wireshark(){
del_stopped wireshark
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
--net host \
--name wireshark \
${DOCKER_REPO_PREFIX}/wireshark
}
wrk(){
docker run -it --rm \
--log-driver none \
--name wrk \
${DOCKER_REPO_PREFIX}/wrk "$@"
}
ykpersonalize(){
del_stopped ykpersonalize
docker run --rm -it \
-v /etc/localtime:/etc/localtime:ro \
--device /dev/usb \
--device /dev/bus/usb \
--name ykpersonalize \
${DOCKER_REPO_PREFIX}/ykpersonalize bash
}
yubico_piv_tool(){
del_stopped yubico-piv-tool
docker run --rm -it \
-v /etc/localtime:/etc/localtime:ro \
--device /dev/usb \
--device /dev/bus/usb \
--name yubico-piv-tool \
${DOCKER_REPO_PREFIX}/yubico-piv-tool bash
}
alias yubico-piv-tool="yubico_piv_tool"
###
### Awesome sauce by @jpetazzo
###
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
docker run -ti -u $(whoami) -w "$HOME" \
$(env | cut -d= -f1 | awk '{print "-e", $1}') \
--device /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 \
"${DOCKER_REPO_PREFIX}/$@"
}