Skip to content

Builder of Docker image with Redis using "Distroless" Docker Image as a base image.

License

Notifications You must be signed in to change notification settings

mabrarov/redis-builder

Repository files navigation

Redis Docker Image Builder

Release License Travis CI build status

Builder of Docker image with Redis using "Distroless" Docker Image as a base image.

Building

Building Requirements

  1. JDK 1.8+
  2. Docker 1.12+
  3. If remote Docker instance is used then DOCKER_HOST environment variable should point to that engine and include the schema, like tcp://docker-host:2375 instead of docker-host:2375.
  4. The current directory is a directory where this repository is cloned.

Building Steps

Building with Maven Wrapper:

./mvnw clean package

or on Windows:

mvnw.cmd clean package

Testing

  1. Redis version

    docker run --rm abrarov/redis:6.2.6-1.2.0

    Expected output looks like:

    Redis server v=6.2.6 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=deb580d722d23776
    
  2. Redis CLI

    container_id="$(docker run -d abrarov/redis:6.2.6-1.2.0 redis-server)" && \
    docker exec "${container_id}" redis-cli ping && \
    docker rm -fv "${container_id}" > /dev/null

    Expected output is:

    PONG
    
  3. j2cli version

    docker run --rm abrarov/j2cli:0.3.10-1.2.0

    Expected output is:

    j2cli 0.3.10, Jinja2 2.11.3
    

Docker Compose

Assuming the current directory is a directory where this repository is cloned.

  • Start

    docker-compose -p redis up -d
  • Test connection to Redis

    docker run --rm --network redis_default abrarov/redis:6.2.6-1.2.0 redis-cli -h redis ping

    Expected output is:

    PONG
    
  • Put some data into Redis

    docker run --rm --network redis_default abrarov/redis:6.2.6-1.2.0 redis-cli -h redis set foo bar

    Expected output is:

    OK
    
  • Stop without removal

    docker-compose -p redis stop -t 120
  • Start stopped instances

    docker-compose -p redis start
  • Test persistence of stored data

    docker run --rm --network redis_default abrarov/redis:6.2.6-1.2.0 redis-cli -h redis get foo

    Expected output is:

    bar
    
  • Stop immediately and remove

    docker-compose -p redis down -v -t 0