-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·47 lines (36 loc) · 1.37 KB
/
Dockerfile
File metadata and controls
executable file
·47 lines (36 loc) · 1.37 KB
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
# Please read carefully
# 1)
# pull centos 7 the latest version
# centos is public on docker hub
# check https://hub.docker.com/_/centos
FROM centos:7
# 2)
# Run the image in a container and execute yum update
# and yum install httpd on the container.
# You can have many RUN commands
RUN yum update -y && yum install httpd -y
# 3)
# Informs Docker that the container listens on the specified network ports
# Though does not actually publish the port.
# It functions as a type of documentation between the person who builds the image
# and the person who runs the container, about which ports are intended to be published
EXPOSE 80
# 4)
# After apache httpd installation, start apache server on the container.
# There can only be one CMD instruction in a Dockerfile.
# If you list more than one CMD then only the last CMD will take effect.
CMD ["/usr/sbin/httpd","-D","FOREGROUND"]
# 5)
# Then copy files (e.g. index.html) from the host to
# /var/www/html/ on the container.
COPY index.html /var/www/html/
COPY img/leo.jpg /var/www/html/img/
COPY img/rongxin.png /var/www/html/img/
COPY img/sergey.png /var/www/html/img/
# 6)
# If everything went fine then docker
# will package the container as a new image
# and then stop and remove the container, so
# docker images
# should contain the new image
#Please read : https://docs.docker.com/engine/reference/builder/