diff --git a/.travis.yml b/.travis.yml index 39256dc..1ddcd30 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ env: - DOCKERFILE_DIR=stacks/dlrs/mkl - DOCKERFILE_DIR=postgres - DOCKERFILE_DIR=nginx + - DOCKERFILE_DIR=redis script: - cd $DOCKERFILE_DIR diff --git a/README.md b/README.md index 39ea764..ba3e810 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Containers - mixer-ci - Keystone - MariaDB +- redis - stacks-dlrs-oss - stacks-dlrs-mkl - stacks-pytorch-oss diff --git a/redis/Dockerfile b/redis/Dockerfile new file mode 100644 index 0000000..7186e83 --- /dev/null +++ b/redis/Dockerfile @@ -0,0 +1,19 @@ +FROM clearlinux:latest +MAINTAINER qi.zheng@intel.com + +ARG swupd_args + +RUN swupd update $swupd_args \ + && swupd bundle-add redis-native $swupd_args \ + && rm -rf /var/lib/swupd/* \ + && mkdir /data && chown redis:redis /data + +VOLUME /data +WORKDIR /data + +COPY docker-entrypoint.sh /usr/local/bin/ +RUN chmod +x /usr/local/bin/docker-entrypoint.sh +ENTRYPOINT ["docker-entrypoint.sh"] + +EXPOSE 6379 +CMD ["redis-server"] diff --git a/redis/README.md b/redis/README.md new file mode 100644 index 0000000..4006f95 --- /dev/null +++ b/redis/README.md @@ -0,0 +1,43 @@ +Redis +========== +This provides a Clear Linux* Redis instance. + +Build +----- +``` +docker build -t clearlinux/redis . +``` + +Or just pull it from Dockerhub +--------------------------- +``` +docker pull clearlinux/redis +``` + +start a redis instance +----------------------- +``` +docker run --name some-redis --network some-network -d clearlinux/redis redis-server --protected-mode no +``` + +connecting via redis-cli +--------------------- +``` +docker run -it --network some-network --rm clearlinux/redis redis-cli -h some-redis +``` + +benchmark test +--------------------- +``` +docker run --network some-network --rm clearlinux/redis redis-benchmark -h some-redis +``` + +details of how-to +--------------------- +Please refer to the official redis image [page](https://hub.docker.com/_/redis). + +Extra Build ARGs +---------------- +- ``swupd_args`` Specifies [SWUPD](https://clearlinux.org/documentation/swupdate_how_to_run_the_updater.html) flags + +Default build args in Docker are on: https://docs.docker.com/engine/reference/builder/#arg diff --git a/redis/docker-entrypoint.sh b/redis/docker-entrypoint.sh new file mode 100644 index 0000000..0b89806 --- /dev/null +++ b/redis/docker-entrypoint.sh @@ -0,0 +1,16 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +# or first arg is `something.conf` +if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then + set -- redis-server "$@" +fi + +# allow the container to be started with `--user` +if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then + find . \! -user redis -exec chown redis '{}' + + echo "su redis -s /bin/bash -c \"$0 $@\"" | exec +fi + +exec "$@"