-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathDockerfile
81 lines (65 loc) · 2.85 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
#name of container: docker-nagios
#versison of container: 0.5.2
FROM quantumobject/docker-baseimage
MAINTAINER Angel Rodriguez "[email protected]"
# Allow postfix to install without interaction.
RUN echo "postfix postfix/mailname string example.com" | debconf-set-selections
RUN echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
#add repository and update the container
#Installation of nesesary package/software for this containers...
RUN apt-get update && apt-get install -y -q wget \
build-essential \
apache2 \
apache2-utils \
php5-gd \
libgd2-xpm-dev \
libapache2-mod-php5 \
postfix \
libssl0.9.8 \
libssl-dev \
&& rm -R /var/www/html
&& apt-get clean \
&& rm -rf /tmp/* /var/tmp/* \
&& rm -rf /var/lib/apt/lists/*
##startup scripts
#Pre-config scrip that maybe need to be run one time only when the container run the first time .. using a flag to don't
#run it again ... use for conf for service ... when run the first time ...
RUN mkdir -p /etc/my_init.d
COPY startup.sh /etc/my_init.d/startup.sh
RUN chmod +x /etc/my_init.d/startup.sh
##Adding Deamons to containers
# to add apache2 deamon to runit
RUN mkdir /etc/service/apache2
COPY apache2.sh /etc/service/apache2/run
RUN chmod +x /etc/service/apache2/run
# to add nagios deamon to runit
RUN mkdir /etc/service/nagios
COPY nagios.sh /etc/service/nagios/run
RUN chmod +x /etc/service/nagios/run
# to add postfix deamon to runit
RUN mkdir /etc/service/postfix
COPY postfix.sh /etc/service/postfix/run
RUN chmod +x /etc/service/postfix/run
COPY postfixstop.sh /etc/service/postfix/finish
RUN chmod +x /etc/service/postfix/finish
#pre-config scritp for different service that need to be run when container image is create
#maybe include additional software that need to be installed ... with some service running ... like example mysqld
COPY pre-conf.sh /sbin/pre-conf
RUN chmod +x /sbin/pre-conf
RUN /bin/bash -c /sbin/pre-conf \
&& rm /sbin/pre-conf
##scritp that can be running from the outside using docker-bash tool ...
## for example to create backup for database with convitation of VOLUME dockers-bash container_ID backup_mysql
COPY backup.sh /sbin/backup
RUN chmod +x /sbin/backup
VOLUME /var/backups
#add files and script that need to be use for this container
#include conf file relate to service/daemon
#additionsl tools to be use internally
# to allow access from outside of the container to the container service
# at that ports need to allow access from firewall if need to access it outside of the server.
EXPOSE 80 25
#creatian of volume
#VOLUME
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]