diff options
Diffstat (limited to 'Services/memcache')
-rw-r--r-- | Services/memcache/Dockerfile | 11 | ||||
-rw-r--r-- | Services/memcache/README.md | 4 | ||||
-rw-r--r-- | Services/memcache/memcache_run.sh | 2 | ||||
-rw-r--r-- | Services/memcache/sx/memcache.sh | 41 | ||||
-rw-r--r-- | Services/memcache/sx/memcache_run.sh | 7 |
5 files changed, 55 insertions, 10 deletions
diff --git a/Services/memcache/Dockerfile b/Services/memcache/Dockerfile index 1038c60..b71fb6f 100644 --- a/Services/memcache/Dockerfile +++ b/Services/memcache/Dockerfile @@ -1,13 +1,10 @@ FROM startx/fedora MAINTAINER Christophe LARUE <dev@startx.fr> -COPY memcache_run.sh /bin/ -RUN yum -y install memcached \ - && yum clean all \ - && chmod ug+rx /bin/memcache_* +RUN yum -y install memcached memcached-selinux && yum clean all +COPY sx/* /sx/ +RUN chmod ug+rx /sx/memcache* EXPOSE 11211 -#CMD ["memcached" , "-u" ," "daemon"] -CMD ["/bin/memcache_run.sh"] -ONBUILD CMD ["/bin/memcache_run.sh"]
\ No newline at end of file +CMD ["/sx/memcache_run.sh"]
\ No newline at end of file diff --git a/Services/memcache/README.md b/Services/memcache/README.md index b463346..a1c1fc7 100644 --- a/Services/memcache/README.md +++ b/Services/memcache/README.md @@ -16,6 +16,8 @@ Copy sources in your docker host cd startx-docker-images; git clone https://github.com/startxfr/docker-images.git . +Change configuration and personalize your base image. See sx/memcache_run.sh to perform some usefull when configuring or every time you run a container. + Build the container docker build -t sv-memcache Services/memcache/ @@ -27,7 +29,7 @@ Build the container ## Accessing server access to the container itself - docker exec -it memcache bash + docker exec -it memcache /bin/bash ## Related Resources * [Sources files](https://github.com/startxfr/docker-images/tree/master/Services/memcache) diff --git a/Services/memcache/memcache_run.sh b/Services/memcache/memcache_run.sh deleted file mode 100644 index f41aae1..0000000 --- a/Services/memcache/memcache_run.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -exec memcached -u daemon
\ No newline at end of file diff --git a/Services/memcache/sx/memcache.sh b/Services/memcache/sx/memcache.sh new file mode 100644 index 0000000..d963a29 --- /dev/null +++ b/Services/memcache/sx/memcache.sh @@ -0,0 +1,41 @@ +#!/bin/bash +export TERM=dumb + +# Begin configuration before starting daemonized process +# and start generating host keys +function begin_config { + echo "=> Begin memcached configuration for host $HOSTNAME" +} + +# End configuration process just before starting daemon +function end_config { + stop_server + echo "=> End memcached configuration ..." +} + +# Start the memcached server in background. Used to perform config +# against the database structure such as user creation +function start_server { + echo "===> Starting memcached server ..." + memcached -u daemon -d & + sleep 8 +} + +# Stop the memcached server running in background. +function stop_server { + echo "===> Stopping memcached server ..." + killall memcached + sleep 8 +} + +# Start the memcached server as a deamon and execute it inside +# the running shell +function start_daemon { + echo "=> Starting memcached daemon ..." + exec memcached -u daemon +} + + +if [[ "$0" == *"memcached.sh" && ! $1 = "" ]];then + eval "$@"; +fi
\ No newline at end of file diff --git a/Services/memcache/sx/memcache_run.sh b/Services/memcache/sx/memcache_run.sh new file mode 100644 index 0000000..8108386 --- /dev/null +++ b/Services/memcache/sx/memcache_run.sh @@ -0,0 +1,7 @@ +#!/bin/bash +source /sx/memcache.sh + +begin_config +end_config + +start_daemon
\ No newline at end of file |