Skip to content

Commit b525f63

Browse files
committed
dockerfiles for inclusion into rhel-dockerfiles package
1 parent 048b5ec commit b525f63

File tree

11 files changed

+1240
-0
lines changed

11 files changed

+1240
-0
lines changed

rhel-httpd/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM redhat/rhel7
2+
MAINTAINER "Scott Collier" <[email protected]>
3+
4+
RUN yum -y update; yum clean all
5+
RUN yum -y install httpd; yum clean all
6+
RUN echo "Apache" >> /var/www/html/index.html
7+
8+
EXPOSE 80
9+
10+
# Simple startup script to avoid some issues observed with container restart
11+
ADD run-apache.sh /run-apache.sh
12+
RUN chmod -v +x /run-apache.sh
13+
14+
CMD ["/run-apache.sh"]

rhel-httpd/LICENSE

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

rhel-httpd/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
dockerfiles-fedora-httpd
2+
========================
3+
4+
Red Hat Enterprise Linux dockerfile for httpd
5+
6+
Tested on Docker 0.10.0-dev
7+
8+
Get Docker version
9+
10+
```
11+
# docker version
12+
```
13+
14+
To build:
15+
16+
Copy the sources down and do the build-
17+
18+
```
19+
# docker build -rm -t <username>/httpd .
20+
```
21+
22+
To run (if port 80 is open on your host):
23+
24+
```
25+
# docker run -d -p 80:80 <username>/httpd
26+
```
27+
28+
or to assign a random port that maps to port 80 on the container:
29+
30+
```
31+
# docker run -d -p 80 <username>/httpd
32+
```
33+
34+
To the port that the container is listening on:
35+
36+
```
37+
# docker ps
38+
```
39+
40+
To test:
41+
42+
```
43+
# curl http://localhost
44+
```

rhel-httpd/run-apache.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
# Make sure we're not confused by old, incompletely-shutdown httpd
4+
# context after restarting the container. httpd won't start correctly
5+
# if it thinks it is already running.
6+
rm -rf /run/httpd/*
7+
8+
exec /usr/sbin/apachectl -D FOREGROUND

rhel-mariadb/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM redhat/rhel7
2+
MAINTAINER scollier <[email protected]>
3+
4+
RUN yum -y update; yum clean all
5+
RUN yum -y install hostname net-tools psmisc mariadb-server mariadb; yum clean all
6+
7+
ADD ./config_mariadb.sh /config_mariadb.sh
8+
9+
RUN chmod 755 /config_mariadb.sh
10+
RUN /config_mariadb.sh
11+
12+
EXPOSE 3306
13+
14+
CMD ["/usr/bin/mysqld_safe"]

rhel-mariadb/LICENSE

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

rhel-mariadb/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
dockerfiles-rhel-MariaDB
2+
========================
3+
4+
Tested on Docker 0.10.0-dev
5+
6+
This repo contains a recipe for making Docker container for MariaDB on Red Hat Enterprise Linux.
7+
8+
Check your Docker version
9+
10+
# docker version
11+
12+
Perform the build
13+
14+
# docker build -rm -t <yourname>/mariadb .
15+
16+
Check the image out.
17+
18+
# docker images
19+
20+
Run it:
21+
22+
# docker run -d -p 3306:3306 <yourname>/mariadb
23+
24+
Get container ID:
25+
26+
# docker ps
27+
28+
Keep in mind the password set for MariaDB is: mariadbPassword
29+
30+
Get the IP address for the container:
31+
32+
# docker inspect --format "{{ .NetworkSettings.IPAddress }}" <container_id>
33+
34+
For MySQL:
35+
36+
# mysql -h 172.17.0.x -utestdb -pmariadbPassword
37+
38+
Create a table:
39+
40+
```
41+
\> show databases;
42+
43+
\> use test;
44+
45+
\> CREATE TABLE test (name VARCHAR(10), owner VARCHAR(10),
46+
-> species VARCHAR(10), birth DATE, death DATE);
47+
48+
\> show tables;
49+
```

rhel-mariadb/config_mariadb.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
__mysql_config() {
4+
# Hack to get MySQL up and running... I need to look into it more.
5+
echo "Running the mysql_config function."
6+
rm -rf /var/lib/mysql/ /etc/my.cnf
7+
mysql_install_db
8+
chown -R mysql:mysql /var/lib/mysql
9+
/usr/bin/mysqld_safe &
10+
sleep 10
11+
}
12+
13+
__start_mysql() {
14+
echo "Running the start_mysql function."
15+
mysqladmin -u root password mariadbPassword
16+
mysql -uroot -pmariadbPassword -e "CREATE DATABASE testdb"
17+
mysql -uroot -pmariadbPassword -e "GRANT ALL PRIVILEGES ON testdb.* TO 'testdb'@'localhost' IDENTIFIED BY 'mariadbPassword'; FLUSH PRIVILEGES;"
18+
mysql -uroot -pmariadbPassword -e "GRANT ALL PRIVILEGES ON *.* TO 'testdb'@'%' IDENTIFIED BY 'mariadbPassword' WITH GRANT OPTION; FLUSH PRIVILEGES;"
19+
mysql -uroot -pmariadbPassword -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mariadbPassword' WITH GRANT OPTION; FLUSH PRIVILEGES;"
20+
mysql -uroot -pmariadbPassword -e "select user, host FROM mysql.user;"
21+
sleep 10
22+
}
23+
24+
# Call all functions
25+
__mysql_config
26+
__start_mysql

rhel-systemd-httpd/Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM redhat/rhel7
2+
MAINTAINER "Dan Walsh" <[email protected]>
3+
4+
ENV container docker
5+
6+
RUN yum -y swap -- remove fakesystemd -- install systemd systemd-libs
7+
8+
RUN yum -y update; yum clean all
9+
RUN yum -y install systemd httpd; yum clean all; \
10+
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
11+
rm -f /lib/systemd/system/multi-user.target.wants/*;\
12+
rm -f /etc/systemd/system/*.wants/*;\
13+
rm -f /lib/systemd/system/local-fs.target.wants/*; \
14+
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
15+
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
16+
rm -f /lib/systemd/system/basic.target.wants/*;\
17+
rm -f /lib/systemd/system/anaconda.target.wants/*; \
18+
systemctl enable httpd.service
19+
20+
RUN echo "Test Server" > /var/www/html/index.html
21+
22+
EXPOSE 80
23+
24+
VOLUME [ "/sys/fs/cgroup" ]
25+
26+
CMD [ "/usr/sbin/init" ]

0 commit comments

Comments
 (0)