-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker.sh
39 lines (32 loc) · 1.83 KB
/
docker.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
#!/bin/bash
### BEFORE RUNNING THIS SCRIPT MAKE SURE TO COMMENT THE BELOW UNNECESSARY PARTS
### RUNNING THIS SCRIPT AS IT IS WILL DELETE ALL YOUR DOCKER CONTAINERS INCLUDING THE DOCKER IMAGES
# stops all existing docker containers
echo -e '\n**********************************************************************************************'
echo Stopping Containers
echo -e '**********************************************************************************************'
# shellcheck disable=SC2046
docker stop $(docker ps -a -q)
# deletes all existing docker containers
echo -e '\n**********************************************************************************************'
echo Deleting Idle Containers
echo -e '**********************************************************************************************'
# shellcheck disable=SC2046
docker rm $(docker ps -a -q)
# force deletes all existing docker images
echo -e '\n**********************************************************************************************'
echo Executing Force Deletion of Docker Images
echo -e '**********************************************************************************************'
# shellcheck disable=SC2046
docker rmi $(docker images -q) -f
# docker images
# builds docker image robinhood with tag 1.0
echo -e '\n**********************************************************************************************'
echo Bulding New Docker Image
echo -e '**********************************************************************************************'
docker build -t robinhood:1.0 .
# runs the docker image
echo -e '\n**********************************************************************************************'
echo Running Docker Image robinhood:1.0
echo -e '**********************************************************************************************'
docker run robinhood:1.0