-
Notifications
You must be signed in to change notification settings - Fork 0
/
Docker-Help.sh
68 lines (48 loc) · 2.32 KB
/
Docker-Help.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
63
64
65
66
67
68
# nginx-1.14.2
## alpine linux image with nginx, lua, sqlite, redis.
### Author: BALAJI POTHULA <*[email protected]*>
#### Cloning nginx-1.14.2 from GitHub.
git clone https://github.com/balajipothula/nginx-1.14.2.git
##### Installing "docker" on Ubuntu OS and
##### setting "tomcat" server with "web application".
sudo sh $HOME/nginx-1.14.2/setup.sh
##### Adding current user to "docker" group.
##### Running docker as non-sudoer.
##### Note: Reboot required.
##### After Reboot sudo not required by "docker".
sudo usermod -a -G docker $USER
##### Pulling image from Docker Hub.
sudo docker pull balajipothula/nginx:1.14.2
##### Creating or Building image from Dockerfile.
##### username/repo:tag.
sudo docker build -t balajipothula/nginx:1.14.2 .
##### Saving docker image offline into local machine.
sudo docker save -o nginx-1.14.2.docker balajipothula/nginx:1.14.2
##### Loading offline docker image into machine.
sudo docker load -i nginx-1.14.2.docker
##### Displaying docker images.
sudo docker images
##### Displaying docker running containers.
sudo docker ps
##### Displaying docker all containers.
sudo docker ps -a
##### Running docker image with volume(-v) stdin(-i) daemon(-d) with port(-p) 80 for NGINX.
##### (It will create a volume inside the container)
sudo docker run --name nginx -d -i -p 80:80 --privileged -v $HOME/nginx-1.14.2/webapp:/webapp balajipothula/nginx:1.14.2 sh
##### Executing docker container by name with stdin(-i), startup NGINX server.
sudo docker exec -i webapp nginx -c /webapp/nginx/conf/nginx.conf
# Executing docker container by name with stdin(-i), nginx process with config file
# and Reloading nginx master process.
sudo docker exec -i webapp nginx -c /webapp/nginx/conf/nginx.conf -s reload
##### Login into docker container.
sudo docker exec -i -t nginx sh
##### Starting docker container with name.
sudo docker start nginx
##### Stoping docker container with name.
sudo docker stop nginx
##### Removing docker container with name.
sudo docker rm nginx
##### Removing docker image with username/repo:tag.
sudo docker rmi balajipothula/nginx:1.14.2
docker image build --tag=netconomy.net/nginx:1.24.0 --file=Dockerfile.NGINX .
docker container run --name=nginx --detach=true --restart=unless-stopped --volume=$HOME/nginx/conf:/nginx/conf --publish=127.0.0.1:80:80/tcp balajipothula/nginx:1.24.0