diff options
Diffstat (limited to 'Services')
24 files changed, 332 insertions, 40 deletions
diff --git a/Services/apache/Dockerfile b/Services/apache/Dockerfile new file mode 100644 index 0000000..c3385d4 --- /dev/null +++ b/Services/apache/Dockerfile @@ -0,0 +1,16 @@ +FROM startx/fedora +MAINTAINER Chistophe LARUE <dev@startx.fr> + +COPY apache_run.sh /bin/ +RUN yum -y install httpd \ +    && yum clean all \ +    && mkdir -p /var/www/html \ +    && mkdir -p /var/log/httpd \ +    && chmod ug+rx /bin/apache_* +COPY welcome.html /var/www/html/index.html + +EXPOSE 80 +EXPOSE 443 + +CMD ["/bin/apache_run.sh"] +ONBUILD CMD ["/bin/apache_run.sh"]
\ No newline at end of file diff --git a/Services/apache/README.md b/Services/apache/README.md new file mode 100644 index 0000000..f0b0326 --- /dev/null +++ b/Services/apache/README.md @@ -0,0 +1,34 @@ +# STARTX Services docker-images : Apache-PHP + +## Running from docker registry + +	# docker run -d -p 8080:80 --name="test-www" -e VIRTUAL_HOST=www.project.startx.fr startx/sv-php + +## Running from local Dockerfile + +### Building docker image +Copy the sources to your docker host  + +	# mkdir startx-docker-images; +	# git clone https://github.com/startxfr/docker-images.git startx-docker-images/ +	# cd startx-docker-images/Services/php/ + +and build the container + +	# docker build --rm -t <username>/www . + +### Running local image + +	# docker run -d -p 8080:80 --name="test-www" -e VIRTUAL_HOST=www.project.startx.fr <username>/www + +## Accessing server + +	# firefox http://localhost:8080 + +## Related Resources + +* [Sources files](https://github.com/startxfr/docker-images/tree/master/Services/php) +* [Github STARTX profile](https://github.com/startxfr/docker-images) +* [Docker registry for this container](https://registry.hub.docker.com/u/startx/sv-php/) +* [tutum php](https://registry.hub.docker.com/u/tutum/apache-php) + diff --git a/Services/apache/apache_run.sh b/Services/apache/apache_run.sh new file mode 100644 index 0000000..0f876ec --- /dev/null +++ b/Services/apache/apache_run.sh @@ -0,0 +1,3 @@ +#!/bin/bash +rm -rf /run/httpd/* +exec /usr/sbin/apachectl -D FOREGROUND
\ No newline at end of file diff --git a/Services/php/welcome_apache.html b/Services/apache/welcome.html index 5c9dfd9..7009644 100644 --- a/Services/php/welcome_apache.html +++ b/Services/apache/welcome.html @@ -6,6 +6,6 @@          <meta name="viewport" content="width=device-width, initial-scale=1.0">      </head>      <body> -        <div>See <a href="https://registry.hub.docker.com/u/startx/" target="_blank">Docker registry</a></div> +        <div>See <a href="https://registry.hub.docker.com/u/startx/" target="_blank">STARTX Docker registry</a></div>      </body>  </html> diff --git a/Services/maria/Dockerfile b/Services/maria/Dockerfile deleted file mode 100644 index 36b987d..0000000 --- a/Services/maria/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ - - -FROM       tutum/mariadb:latest -MAINTAINER startx dev@startx.fr - - diff --git a/Services/mariadb/Dockerfile b/Services/mariadb/Dockerfile new file mode 100644 index 0000000..b354a0e --- /dev/null +++ b/Services/mariadb/Dockerfile @@ -0,0 +1,22 @@ +FROM startx/fedora +MAINTAINER Chistophe LARUE <dev@startx.fr> + +COPY mariadb_run.sh /bin/ +RUN yum -y install \ +    mariadb-libs \ +    mariadb-server \ +    mariadb \ +    && yum clean all \ +    && mkdir -p /var/log/mysql \ +    && touch /var/log/mysql/.keep /var/lib/mysql/.keep \ +    && chown -R mysql:mysql /var/log/mysql /var/lib/mysql \ +    && chmod ug+rx /bin/mariadb_* + +VOLUME ["/var/lib/mysql", "/var/log/mysql"] +USER mysql + +EXPOSE 3306 + +#CMD ["/usr/libexec/mysqld"] +CMD ["/bin/mariadb_run.sh"] +ONBUILD CMD ["/bin/mariadb_run.sh"]
\ No newline at end of file diff --git a/Services/maria/README.md b/Services/mariadb/README.md index f81f3de..f81f3de 100644 --- a/Services/maria/README.md +++ b/Services/mariadb/README.md diff --git a/Services/mariadb/mariadb_run.sh b/Services/mariadb/mariadb_run.sh new file mode 100644 index 0000000..b5b1421 --- /dev/null +++ b/Services/mariadb/mariadb_run.sh @@ -0,0 +1,56 @@ +#!/bin/bash +ln -s /dev/stderr /var/log/mysql/mysqld.log +if [ ! -f /var/lib/mysql/.created ]; then +  function wait_for_mysqld_start { +    for i in {1..30}; do +      if echo 'select 1' | mysql -u root > /dev/null 2>&1; then +        return 0 +      fi +      sleep 1 +    done + +    echo "MariaDB did not start in time" +    exit 1 +  } + + + +  password=${DB_PASSWORD:-password} +  dbname=${DB_NAME:-master} + +  /usr/bin/mysql_install_db -u mysql + +  /usr/libexec/mysqld & +  pid=$! + +  wait_for_mysqld_start + +  echo "Creating database $dbname ..." + +  sql=$(cat <<SQL +  drop database if exists test; +  create database \`$dbname\` +     DEFAULT CHARACTER SET utf8 DEFAULT +     COLLATE utf8_general_ci; +SQL +) +  echo $sql | mysql -u root + +  #delete from user; + +  sql=$(cat <<SQL +    delete from user where user=''; +    grant all on *.* to 'mysql'@'localhost' identified by '$password' with grant option; +    grant all on *.* to 'mysql'@'%' identified by '$password' with grant option; +    flush privileges; +SQL +) +  echo $sql | mysql -u root mysql + +  touch /var/lib/mysql/.created +  kill -TERM $pid + +  echo "Starting mysqld ..." +fi + +exec /usr/libexec/mysqld
\ No newline at end of file diff --git a/Services/memcache/Dockerfile b/Services/memcache/Dockerfile new file mode 100644 index 0000000..b1150c1 --- /dev/null +++ b/Services/memcache/Dockerfile @@ -0,0 +1,13 @@ +FROM startx/fedora +MAINTAINER Chistophe LARUE <dev@startx.fr> + +COPY memcache_run.sh /bin/ +RUN yum -y install memcached \ +    && yum clean all \ +    && chmod ug+rx /bin/memcache_* + +EXPOSE 11211 + +#CMD ["memcached" , "-u" ," "daemon"] +CMD ["/bin/memcache_run.sh"] +ONBUILD CMD ["/bin/memcache_run.sh"]
\ No newline at end of file diff --git a/Services/memcache/README.md b/Services/memcache/README.md new file mode 100644 index 0000000..f81f3de --- /dev/null +++ b/Services/memcache/README.md @@ -0,0 +1,16 @@ +docker-images MariaDB +===================== + +**Description** +Based on the [tutum php](https://registry.hub.docker.com/u/tutum/mariadb) Dockerfile + +**Usage**   +	 +          docker run --name="test-maria" -d startx/sv-maria + +          docker run --name="test-maria" -d startx/sv-maria +          docker run -d -p 3306:3306 startx/sv-maria +          docker run -d -p 3306:3306 --name="test-maria" startx/sv-maria + +          docker run -d --name="test-maria" startx/sv-maria // linked to another container +          docker run -d --name="test-www" --link test-maria:maria startx/sv-php diff --git a/Services/memcache/memcache_run.sh b/Services/memcache/memcache_run.sh new file mode 100644 index 0000000..f41aae1 --- /dev/null +++ b/Services/memcache/memcache_run.sh @@ -0,0 +1,2 @@ +#!/bin/bash +exec memcached -u daemon
\ No newline at end of file diff --git a/Services/mongo/Dockerfile b/Services/mongo/Dockerfile index 76d7a2f..5367713 100644 --- a/Services/mongo/Dockerfile +++ b/Services/mongo/Dockerfile @@ -1,6 +1,25 @@ +FROM startx/fedora +MAINTAINER Chistophe LARUE <dev@startx.fr> +COPY mongo_run.sh /bin/ +RUN yum -y install \ +    mongodb \ +    mongodb-server \ +    libmongo-client \ +    rsyslog-mongodb \ +    mongodb-mms-backup-agent \ +    mongodb-mms-monitoring-agent \ +    && yum clean all \ +    && mkdir -p /var/lib/mongodb \ +    && touch /var/lib/mongodb/.keep \ +    && chown -R mongod:mongod /var/lib/mongodb \ +    && chmod ug+rx /bin/mongo_*  -FROM       mongo:latest -MAINTAINER startx dev@startx.fr +VOLUME ["/var/lib/mongodb"] +USER mongod +EXPOSE 27017 +#CMD ["/usr/bin/mongod", "--config", "/etc/mongodb.conf"] +CMD ["/bin/mongo_run.sh"] +ONBUILD CMD ["/bin/mongo_run.sh"]
\ No newline at end of file diff --git a/Services/mysql/Dockerfile b/Services/mysql/Dockerfile deleted file mode 100644 index cbb6d9c..0000000 --- a/Services/mysql/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ - - -FROM       mysql:latest -MAINTAINER startx dev@startx.fr - diff --git a/Services/mysql/README.md b/Services/mysql/README.md deleted file mode 100644 index 8e15a2e..0000000 --- a/Services/mysql/README.md +++ /dev/null @@ -1,13 +0,0 @@ -STARTX docker-images - Mysql -============================ - -**Description**   -Based on the docker [default mysql](https://registry.hub.docker.com/_/mysql/) Dockerfile - -**Usage**   - -          docker run -d -p 3306:3306 startx/sv-mysql -          docker run -d -p 3306:3306 --name="test-mysql" -e MYSQL_ROOT_PASSWORD=mysecretpassword startx/sv-mysql - -          docker run -d --name="test-mysql" startx/sv-mysql // linked to another container -          docker run -d --name="test-www" --link test-mysql:mysql startx/sv-php diff --git a/Services/nodejs/Dockerfile b/Services/nodejs/Dockerfile new file mode 100644 index 0000000..99d3023 --- /dev/null +++ b/Services/nodejs/Dockerfile @@ -0,0 +1,18 @@ +FROM startx/fedora +MAINTAINER Chistophe LARUE <dev@startx.fr> + +COPY nodejs_run.sh /bin/ +RUN yum -y install nodejs npm \ +    && yum clean all \ +    && mkdir -p /var/www/html \ +    && mkdir -p /var/log/httpd \ +    && chmod ug+rx /bin/nodejs_* + +WORKDIR /src +COPY app.js /src/app.js + +EXPOSE 8000 + +#CMD ["node", "/src/app.js"] +CMD ["/bin/nodejs_run.sh"] +ONBUILD CMD ["/bin/nodejs_run.sh"]
\ No newline at end of file diff --git a/Services/nodejs/README.md b/Services/nodejs/README.md new file mode 100644 index 0000000..f0b0326 --- /dev/null +++ b/Services/nodejs/README.md @@ -0,0 +1,34 @@ +# STARTX Services docker-images : Apache-PHP + +## Running from docker registry + +	# docker run -d -p 8080:80 --name="test-www" -e VIRTUAL_HOST=www.project.startx.fr startx/sv-php + +## Running from local Dockerfile + +### Building docker image +Copy the sources to your docker host  + +	# mkdir startx-docker-images; +	# git clone https://github.com/startxfr/docker-images.git startx-docker-images/ +	# cd startx-docker-images/Services/php/ + +and build the container + +	# docker build --rm -t <username>/www . + +### Running local image + +	# docker run -d -p 8080:80 --name="test-www" -e VIRTUAL_HOST=www.project.startx.fr <username>/www + +## Accessing server + +	# firefox http://localhost:8080 + +## Related Resources + +* [Sources files](https://github.com/startxfr/docker-images/tree/master/Services/php) +* [Github STARTX profile](https://github.com/startxfr/docker-images) +* [Docker registry for this container](https://registry.hub.docker.com/u/startx/sv-php/) +* [tutum php](https://registry.hub.docker.com/u/tutum/apache-php) + diff --git a/Services/nodejs/app.js b/Services/nodejs/app.js new file mode 100644 index 0000000..1dd5446 --- /dev/null +++ b/Services/nodejs/app.js @@ -0,0 +1,14 @@ +// Load the http module to create an http server. +var http = require('http'); + +// Configure our HTTP server to respond with Hello World to all requests. +var server = http.createServer(function (request, response) { +  response.writeHead(200, {"Content-Type": "text/plain"}); +  response.end("Hello World\n"); +}); + +// Listen on port 8000, IP defaults to 127.0.0.1 +server.listen(8000); + +// Put a friendly message on the terminal +console.log("Server running at http://127.0.0.1:8000/");
\ No newline at end of file diff --git a/Services/nodejs/nodejs_run.sh b/Services/nodejs/nodejs_run.sh new file mode 100644 index 0000000..b63a40c --- /dev/null +++ b/Services/nodejs/nodejs_run.sh @@ -0,0 +1,2 @@ +#!/bin/bash +exec node /src/app.js
\ No newline at end of file diff --git a/Services/php/Dockerfile b/Services/php/Dockerfile index fe2e8ca..730c4af 100644 --- a/Services/php/Dockerfile +++ b/Services/php/Dockerfile @@ -1,13 +1,15 @@ -FROM startx/fedora +FROM startx/sv-apache  MAINTAINER Chistophe LARUE <dev@startx.fr> -RUN yum -y update && yum clean all -RUN yum -y install httpd php php-pecl-mongo php-cli php-pear php-gd php-google-apiclient php-pecl-zip php-mcrypt php-tcpdf php-xml-5.5.18-1.fc20 php-mysqlnd php-soap php-pecl-jsonc php-pecl-xdebug php-pdo php-process php-common php-mbstring && yum clean all -ADD welcome_apache.html /var/www/html/index.html - -EXPOSE 80 - -# avoid some issues observed with container restart  -RUN rm -rf /run/httpd/* - -ENTRYPOINT ["/usr/sbin/apachectl", "-D FOREGROUND"]
\ No newline at end of file +WORKDIR /src +RUN yum -y install php php-pecl-mongo php-cli php-pear \ +        php-gd php-mcrypt php-mysqlnd php-soap php-pecl-xdebug \ +        php-pdo php-process php-common php-mbstring \ +        php-bcmath php-pecl-zip php-php-gettext php-tcpdf \ +        php-tcpdf-dejavu-sans-fonts php-tidy \ +    && yum clean all \ +    && rm -rf /var/www/html \ +    && ln -s /src /var/www/html +ADD index.php /src/index.php + +CMD ["/bin/apache_run.sh"]
\ No newline at end of file diff --git a/Services/php/index.php b/Services/php/index.php new file mode 100644 index 0000000..c9f5eeb --- /dev/null +++ b/Services/php/index.php @@ -0,0 +1 @@ +<?php phpinfo(); ?>
\ No newline at end of file diff --git a/Services/postgres/Dockerfile b/Services/postgres/Dockerfile index f16fe0c..7997d9d 100644 --- a/Services/postgres/Dockerfile +++ b/Services/postgres/Dockerfile @@ -1,5 +1,24 @@ +FROM startx/fedora +MAINTAINER Chistophe LARUE <dev@startx.fr> -FROM       postgres:latest -MAINTAINER startx dev@startx.fr +COPY postgres_run.sh postgres_modify_pass.sh /bin/ +RUN yum -y install \ +    mariadb-galera-common \ +    mariadb-galera-server \ +    mariadb-libs \ +    mariadb-server \ +    mariadb \ +    && yum clean all \ +    && mkdir -p /var/log/mysql \ +    && touch /var/log/mysql/.keep /var/lib/mysql/.keep \ +    && chown -R mysql:mysql /var/log/mysql /var/lib/mysql \ +    && chmod ug+rx /bin/postgres_* +VOLUME	["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"] +USER postgresql +EXPOSE 5432 + +#CMD ["/usr/libexec/pgsqld"] +CMD ["/bin/postgres_run.sh"] +ONBUILD CMD ["/bin/postgres_run.sh"]
\ No newline at end of file diff --git a/Services/ssh/.ssh/authorized_keys b/Services/ssh/.ssh/authorized_keys new file mode 100644 index 0000000..0dbe4dc --- /dev/null +++ b/Services/ssh/.ssh/authorized_keys @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7pCBSddCIi/lOH+z6KdkyS/JLGFCQTH8u+JyHoqUj8X9nVty6xBWNTdYDq5/0vUFLUtOxMlX9noV8JddA/XFAWpGmQU8KDq3dcqjWJXZ4NUiXwDrysP7JryVXBDidZC16ObAGw58a2/5BiXs+WGoSkkNUFZN3rbIaurrth1ODD67YZiL+Jzts2KyJednn8bM+rmmMvvhKFzV4QnmgbYF0OvdAucaMTWrdmkuY/VVse1l2LxxEx2IFz/q6dxH8uuQUGXjESXlHw5I0Fi0lhMDQ9M8xqI9AKeu87R+UPKxyOZjwGpz5Fui5yKuJOHsjY57Mze5wTOnu+YdVxJOwpJhN cl@startx.fr
\ No newline at end of file diff --git a/Services/ssh/Dockerfile b/Services/ssh/Dockerfile new file mode 100644 index 0000000..ce02260 --- /dev/null +++ b/Services/ssh/Dockerfile @@ -0,0 +1,16 @@ +FROM startx/fedora +MAINTAINER Chistophe LARUE <dev@startx.fr> + +# Install packages and set up sshd +RUN yum -y update \ +    && yum -y install openssh-server \ +    && yum clean all +RUN mkdir /var/run/sshd \ +    && ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' + +# Add ssh keys +COPY .ssh/authorized_keys /root/.ssh/authorized_keys + +EXPOSE 22 +CMD ["/usr/sbin/sshd", "-D"] +ONBUILD CMD ["/usr/sbin/sshd", "-D"] diff --git a/Services/ssh/README.md b/Services/ssh/README.md new file mode 100644 index 0000000..3417d98 --- /dev/null +++ b/Services/ssh/README.md @@ -0,0 +1,28 @@ +# STARTX Services docker-images : SSH Server +This container run sshd on fedora server. You can overwrite /root/.ssh/autorized_keys with your own list of autorized keys. + +## Running from docker registry + +	# docker run -d -p 22022:22 --name="ssh" startx/sv-ssh + +## Build and run from local Dockerfile +### Building docker image +Copy the sources to your docker host  +        # mkdir startx-docker-images;  +        # cd startx-docker-images; +        # git clone https://github.com/startxfr/docker-images.git . + +and build the container +        # docker build -t sv-ssh Services/ssh/ + +### Running local image +	# docker run -d -p 22022:22 --name="ssh" sv-ssh + +## Accessing server +	# ssh -p 22022 root@<containerId> + +## Related Resources +* [Sources files](https://github.com/startxfr/docker-images/tree/master/OS/Fedora) +* [Github STARTX profile](https://github.com/startxfr/docker-images) +* [Docker registry for this container](https://registry.hub.docker.com/u/startx/fedora/) +* [Docker registry for Fedora](https://registry.hub.docker.com/u/fedora/ssh/)  | 
