-
Notifications
You must be signed in to change notification settings - Fork 522
/
.dockerfunc
1327 lines (1228 loc) · 30 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
995
996
997
998
999
1000
#!/bin/bash
# Bash wrappers for docker run commands
export DOCKER_REPO_PREFIX=jess
#
# Helper Functions
#
dcleanup(){
local containers
mapfile -t containers < <(docker ps -aq 2>/dev/null)
docker rm "${containers[@]}" 2>/dev/null
local volumes
mapfile -t volumes < <(docker ps --filter status=exited -q 2>/dev/null)
docker rm -v "${volumes[@]}" 2>/dev/null
local images
mapfile -t images < <(docker images --filter dangling=true -q 2>/dev/null)
docker rmi "${images[@]}" 2>/dev/null
mapfile -t images < <(docker images -q 2>/dev/null)
docker rmi "${images[@]}" 2>/dev/null
docker system prune -f
}
del_stopped(){
local name=$1
local state
state=$(docker inspect --format "{{.State.Running}}" "$name" 2>/dev/null)
if [[ "$state" == "false" ]]; then
docker rm "$name"
fi
}
rmctr(){
# shellcheck disable=SC2068
docker rm -f $@ 2>/dev/null || true
}
relies_on(){
for container in "$@"; do
local state
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
hostess add "$server" 127.0.0.1
# open browser
browser-exec "http://${server}"
}
#
# Container Aliases
#
apt_file(){
if [[ -n "$(which apt-file)" ]]; then
"$(which apt-file)" "$@"
else
docker run --rm -it \
--name apt-file \
${DOCKER_REPO_PREFIX}/apt-file
fi
}
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(){
if [[ -n "$(which aws)" ]]; then
"$(which aws)" "$@"
else
docker run -it --rm \
-v "${HOME}/.aws:/root/.aws" \
--log-driver none \
--name aws \
${DOCKER_REPO_PREFIX}/awscli "$@"
fi
}
az(){
docker run -it --rm \
-v "${HOME}/.azure:/root/.azure" \
--log-driver none \
${DOCKER_REPO_PREFIX}/azure-cli "$@"
}
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
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
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(){
if [[ -n "$(which consul)" ]]; then
"$(which consul)" "$@"
else
del_stopped consul
# check if we passed args and if consul is running
local state
state=$(docker inspect --format "{{.State.Running}}" consul 2>/dev/null)
if [[ "$state" == "true" ]] && [[ "$*" != "" ]]; 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
hostess add consul "$(docker inspect --format '{{.NetworkSettings.Networks.bridge.IPAddress}}' consul)"
browser-exec "http://consul:8500"
fi
}
cura(){
del_stopped cura
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=unix${DISPLAY}" \
-v "${HOME}/cura:/root/cura" \
-v "${HOME}/.cache/cura:/root/.cache/cura" \
-v "${HOME}/.config/cura:/root/.config/cura" \
-e QT_DEVICE_PIXEL_RATIO \
-e GDK_SCALE \
-e GDK_DPI_SCALE \
--device /dev/dri \
--name cura \
${DOCKER_REPO_PREFIX}/cura
}
dcos(){
docker run -it --rm \
-v "${HOME}/.dcos:/root/.dcos" \
-v "$(pwd):/root/apps" \
-w /root/apps \
${DOCKER_REPO_PREFIX}/dcos-cli "$@"
}
figma() {
del_stopped figma
docker run --rm -it \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=unix${DISPLAY}" \
--name figma \
${DOCKER_REPO_PREFIX}/figma-wine bash
}
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
}
fleetctl(){
docker run --rm -it \
--entrypoint fleetctl \
-v "${HOME}/.fleet://.fleet" \
r.j3ss.co/fleet "$@"
}
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 "$@"
}
dgcloud(){
docker run --rm -it \
-v "${HOME}/.gcloud:/root/.config/gcloud" \
-v "${HOME}/.ssh:/root/.ssh:ro" \
-v "$(command -v docker):/usr/bin/docker" \
-v /var/run/docker.sock:/var/run/docker.sock \
--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
}
gitsome(){
docker run --rm -it \
-v /etc/localtime:/etc/localtime:ro \
--name gitsome \
--hostname gitsome \
-v "${HOME}/.gitsomeconfig:/home/anon/.gitsomeconfig" \
-v "${HOME}/.gitsomeconfigurl:/home/anon/.gitsomeconfigurl" \
${DOCKER_REPO_PREFIX}/gitsome
}
hollywood(){
docker run --rm -it \
--name hollywood \
${DOCKER_REPO_PREFIX}/hollywood
}
htop(){
if [[ -n "$(which htop)" ]]; then
"$(which htop)" "$@"
else
docker run --rm -it \
--pid host \
--net none \
--name htop \
${DOCKER_REPO_PREFIX}/htop
fi
}
htpasswd(){
docker run --rm -it \
--net none \
--name htpasswd \
--log-driver none \
${DOCKER_REPO_PREFIX}/htpasswd "$@"
}
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 \
--user root \
-v "${HOME}/.irssi:/home/user/.irssi" \
irssi \
chown -R user /home/user/.irssi
docker run --rm -it \
-v /etc/localtime:/etc/localtime:ro \
-v "${HOME}/.irssi:/home/user/.irssi" \
--read-only \
--name irssi \
irssi
}
john(){
local file
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 \
-v /lib/modules:/lib/modules \
-v /boot:/boot \
--name kernel-builder \
${DOCKER_REPO_PREFIX}/kernel-builder
}
keypassxc(){
del_stopped keypassxc
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /usr/share/X11/xkb:/usr/share/X11/xkb:ro \
-e "DISPLAY=unix${DISPLAY}" \
-v /etc/machine-id:/etc/machine-id:ro \
--name keypassxc \
${DOCKER_REPO_PREFIX}/keepassxc
}
kicad(){
del_stopped kicad
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=unix${DISPLAY}" \
-v "${HOME}/kicad:/root/kicad" \
-v "${HOME}/.cache/kicad:/root/.cache/kicad" \
-v "${HOME}/.config/kicad:/root/.config/kicad" \
-e QT_DEVICE_PIXEL_RATIO \
-e GDK_SCALE \
-e GDK_DPI_SCALE \
--device /dev/dri \
--name kicad \
${DOCKER_REPO_PREFIX}/kicad
}
kvm(){
del_stopped kvm
relies_on pulseaudio
# modprobe the module
modprobe kvm
docker run -d \
--tmpfs /var/run \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v "${HOME}/kvm:/root/kvm" \
-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 \
--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(){
if [[ -n "$(which lynx)" ]]; then
"$(which lynx)" "$@"
else
docker run --rm -it \
--name lynx \
${DOCKER_REPO_PREFIX}/lynx "$@"
fi
}
masscan(){
docker run -it --rm \
--log-driver none \
--net host \
--cap-add NET_ADMIN \
--name masscan \
${DOCKER_REPO_PREFIX}/masscan "$@"
}
mc(){
cwd="$(pwd)"
name="$(basename "$cwd")"
docker run --rm -it \
--log-driver none \
-v "${cwd}:/home/mc/${name}" \
--workdir "/home/mc/${name}" \
${DOCKER_REPO_PREFIX}/mc "$@"
}
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
export GMAIL=$MAIL_RISEUP
export GMAIL_NAME=$MAIL_RISEUP_NAME
export GMAIL_PASS=$MAIL_RISEUP_PASS
export 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(){
if [[ -n "$(which nmap)" ]]; then
"$(which nmap)" "$@"
else
docker run --rm -it \
--net host \
${DOCKER_REPO_PREFIX}/nmap "$@"
fi
}
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}"
}
now(){
docker run -it --rm \
-v "${HOME}/.now:/root/.now" \
-v "$(pwd):/usr/src/repo:ro" \
--workdir /usr/src/repo \
--log-driver none \
${DOCKER_REPO_PREFIX}/now "$@"
}
openscad(){
del_stopped openscad
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=unix${DISPLAY}" \
-v "${HOME}/openscad:/root/openscad" \
-v "${HOME}/.config/OpenSCAD:/root/.config/OpenSCAD" \
-e QT_DEVICE_PIXEL_RATIO \
-e GDK_SCALE \
-e GDK_DPI_SCALE \
--device /dev/dri \
--name openscad \
${DOCKER_REPO_PREFIX}/openscad
}
opensnitch(){
del_stopped opensnitchd
del_stopped opensnitch
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
--net host \
--cap-add NET_ADMIN \
-v /etc/machine-id:/etc/machine-id:ro \
-v /var/run/dbus:/var/run/dbus \
-v /usr/share/dbus-1:/usr/share/dbus-1 \
-v "/var/run/user/$(id -u):/var/run/user/$(id -u)" \
-e DBUS_SESSION_BUS_ADDRESS \
-e XAUTHORITY \
-v "${HOME}/.Xauthority:$HOME/.Xauthority" \
-v /tmp:/tmp \
--name opensnitchd \
${DOCKER_REPO_PREFIX}/opensnitchd
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=unix${DISPLAY}" \
-v /usr/share/X11:/usr/share/X11:ro \
-v /usr/share/dbus-1:/usr/share/dbus-1 \
-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 DBUS_SESSION_BUS_ADDRESS \
-e XAUTHORITY \
-v "${HOME}/.Xauthority:$HOME/.Xauthority" \
-e HOME \
-e QT_DEVICE_PIXEL_RATIO \
-e XDG_RUNTIME_DIR \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/group:/etc/group:ro \
-v /tmp:/tmp \
-u "$(id -u)" -w "$HOME" \
--net host \
--name opensnitch \
${DOCKER_REPO_PREFIX}/opensnitch
}
osquery(){
rmctr osquery
docker run -d --restart always \
-v /etc/localtime:/etc/localtime:ro \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /etc/os-release:/etc/os-release:ro \
--net host \
--ipc host \
--pid host \
-e OSQUERY_ENROLL_SECRET \
--name osquery \
--privileged \
${DOCKER_REPO_PREFIX}/osquery \
--verbose \
--enroll_secret_env=OSQUERY_ENROLL_SECRET \
--docker_socket=/var/run/docker.sock \
--host_identifier=hostname \
--tls_hostname="${OSQUERY_DOMAIN}" \
--enroll_tls_endpoint=/api/v1/osquery/enroll \
--config_plugin=tls \
--config_tls_endpoint=/api/v1/osquery/config \
--config_tls_refresh=10 \
--disable_distributed=false \
--distributed_plugin=tls \
--distributed_interval=10 \
--distributed_tls_max_attempts=3 \
--distributed_tls_read_endpoint=/api/v1/osquery/distributed/read \
--distributed_tls_write_endpoint=/api/v1/osquery/distributed/write \
--logger_plugin=tls \
--logger_tls_endpoint=/api/v1/osquery/log \
--logger_tls_period=10
}
pandoc(){
if [[ -n "$(which pandoc)" ]]; then
"$(which pandoc)" "$@"
else
local file=${*: -1}
local lfile
lfile=$(readlink -m "$(pwd)/${file}")
local rfile
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}"
fi
}
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
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
}
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 "${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
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}/.slack:/root/.config/Slack" \
--ipc="host" \
--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
file=$(realpath "$1")
docker run --rm -it \
-v "${file}:/root/$(basename "${file}")" \
--entrypoint ssh2john \
${DOCKER_REPO_PREFIX}/john "$@"
}
sshb0t(){
del_stopped sshb0t
if [[ ! -d "${HOME}/.ssh" ]]; then
mkdir -p "${HOME}/.ssh"
fi
if [[ ! -f "${HOME}/.ssh/authorized_keys" ]]; then
touch "${HOME}/.ssh/authorized_keys"
fi
GITHUB_USER=${GITHUB_USER:=jessfraz}
docker run --rm -it \
--name sshb0t \
-v "${HOME}/.ssh/authorized_keys:/root/.ssh/authorized_keys" \
r.j3ss.co/sshb0t \
--user "${GITHUB_USER}" --keyfile /root/.ssh/authorized_keys --once
}
steam(){
del_stopped steam
relies_on pulseaudio