-
Notifications
You must be signed in to change notification settings - Fork 2
/
go.bat
36 lines (27 loc) · 823 Bytes
/
go.bat
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
@echo off
echo Docker nginx build, run and clean up script
echo Author: mikey-no
echo Created: 27 Sep 2017
echo Last modified: 30 Sep 2018 - tweeked to work with ASW EC2, exposing fixing to port 80
echo works from Powershell
set image=mynginximage
set tag=lastest
set conrun=mynginx
echo Start by cleaning up...
docker rmi -f %image%
docker stop %conrun%
docker rm %conrun%
echo Build the image...
docker build -t %image% .
echo Run the image...
docker run --name %conrun% -p 80:80 -d %image%
echo Show the running containers...
docker ps
echo To open a terminal inside the container...
echo run this command: docker exec -it [container-id] bash
echo run this command: docker exec -it $(docker ps -a--filter name=%conrun%) bash
pause
echo Cleanup....
docker stop %conrun%
docker rm %conrun%
docker rmi -f %image%