-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathdocker_tools_alias.sh
62 lines (48 loc) · 1.03 KB
/
docker_tools_alias.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
60
61
62
#!/bin/bash
if [ -z "$INFRA_IMAGE_NAME" ]; then
INFRA_IMAGE_NAME="local-infra-tools"
docker build -t $INFRA_IMAGE_NAME .
echo -e "build image \e[36m$INFRA_IMAGE_NAME\e[0m"
fi
drun ()
{
docker run --rm ${TTY} \
-w /home/ubuntu \
-v "$(pwd)":/home/ubuntu \
-v ~/.ssh:/home/ubuntu/.ssh \
-v ~/.aws:/home/ubuntu/.aws \
-e AWS_PROFILE \
"$INFRA_IMAGE_NAME" "$@"
}
echo -e "use \e[36mdasb\e[0m for \e[36mansible\e[0m in docker"
dasb ()
{
drun ansible "$@"
}
echo -e "use \e[36mdap\e[0m for \e[36mansible-playbook\e[0m in docker"
dap ()
{
drun ansible-playbook "$@"
}
echo -e "use \e[36mdaws\e[0m for \e[36mawscli\e[0m in docker"
daws ()
{
drun aws "$@"
}
echo -e "use \e[36mdpk\e[0m for \e[36mpacker\e[0m in docker"
dpk ()
{
drun packer "$@"
}
echo -e "use \e[36mdtf\e[0m for \e[36mterraform\e[0m in docker"
dtf ()
{
drun terraform "$@"
}
echo -e "use \e[36mdbash\e[0m for \e[36mbash\e[0m in docker"
dbash ()
{
TTY="-it"
drun bash "$@"
unset TTY
}