-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
104 lines (85 loc) · 2.13 KB
/
Dockerfile
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
FROM ubuntu:22.04
LABEL autor=Burmetskyi
RUN apt-get update
RUN apt-get install nginx -y
WORKDIR /var/www/html/
COPY files2/index.html
COPY files2/script.sh /opt/script.sh
RUN chmod +x /opt/script.sh
ENV OWNER="Burmetskyi"
ENV TYPE=demo
EXPOSE 80
ENTRYPOINT ["echo"]
CMD ["Hello my FIRST Docker"]
# Commands
- docker build <path>
- docker tag <imageID> <name:version>
- docker run --rm --name mydocker mydocker:v01
- docker image inspect mydocker:v01
- netstat -tulpe
# nginx web server
FROM ubuntu:22.04
LABEL autor=Burmetskyi
RUN apt-get update
RUN apt-get install nginx -y
EXPOSE 80
EXPOSE 443/tcp
CMD ["nginx","-g","daemon off"]
# apache web server
FROM ubuntu:22.04
LABEL autor=Burmetskyi
RUN apt-get update
RUN apt-get install apache2 -y
EXPOSE 80
CMD ["apache2ctl","-D","FOREGROUND"]
- docker run -d --rm --name d1 -p 80:80 -v <absolute/path>:/var/www/html mynginx:01
# ENV
- docker run -d --rm --name d2 -e TYPE=prod mynginx:05
FROM ubuntu:22.04
LABEL autor=Burmetskyi
RUN apt-get update
RUN apt-get install apache2 -y
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /var/www/html
COPY files/index.html .
ENV OWNER=Burmetskyi
ENV TYPE=demo
EXPOSE 80
CMD ["apache2ctl","-D","FOREGROUND"]
- docker run --rm --name d1 -it -e OWNER=Billie myenv:01 /bin/bash
# SCRIPT.SH
DELETE< #!/bin/bash
sed -i 's|%OWNER%|'"$OWNER"'|g' /var/www/html/index.html
sed -i 's|%TYPE%|'"$TYPE"'|g' /var/www/html/index.html
echo "Start Script --- OK"
nginx -g 'daemon off;'
# dokerfile
FROM ubuntu:22.04
LABEL autor=Burmetskyi
RUN apt-get update
RUN apt-get install nginx -y
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /var/www/html
COPY files/index.html .
COPY files/script.sh /opt/script.sh
RUN chmod +x /opt/script.sh
ENV OWNER=Burmetwkyi
ENV TYPE=demo
EXPOSE 80
CMD ["/opt/script.sh"]
# PHP container
<?php
phpinfo();
phpinfo(INFO_MODULES);
?>
FROM php:7.2-apache
COPY index.php /var/www/html/
# Python app
num1 = input('Enter first number: ')
num2 = input('Enter second number: ')
sum = float(num1) + float(num2)
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))
FROM python:3
WORKDIR /usr/src/app
COPY sum.py ./
CMD [ "python", "./sum.py" ]