Redis Docker and Raspberry Pi
RedisDockerandRaspberryPi
1BuildandInstallonContainerServer
Downloadthelatestsource
>gitclonehttps://github.com/antirez/redis.git
>cdredis/
Build
>make
Install
>makePREFIX=/home/carl/tool/redis-2016-08-26install
Ifnotthelatest,letinstallwithonestableversion
>wgethttp://download.redis.io/releases/redis-3.2.3.tar.gz
UnzipandBuildandInstall
>cdredis-3.2.3/
>make
>makePREFIX=/home/carl/tool/redis-3.2.3install
Linkthefiletomytooldirectory,addtoPATH
PATH="/opt/redis/bin:$PATH"
Checkversion
>redis-cli--version
redis-cli3.2.3
2DockertheApplicationandAUTHConfig
conf/redis.confConfigurationfile
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#bind127.0.0.1
bind0.0.0.0
requirepassPASSWORD
Dockerfileshowustheinstallationindetails.
FROMresin/rpi-raspbian:jessie
MAINTAINERCarlLuo<[email protected]>
ENVDEBIAN_FRONTENDnoninteractive
RUNecho"debhttp://mirrordirector.raspbian.org/raspbian/jessiemaincontribnon-freerpi\n\
deb-srchttp://archive.raspbian.org/raspbian/jessiemaincontribnon-freerpi\n\
">/etc/apt/sources.list
RUNapt-get-yupdate
RUNapt-getinstall-yapt-utils
RUNapt-get-ydist-upgrade
RUNapt-getinstall-ybuild-essentialgccmake
#installthesoftware
ADDinstall/redis-3.2.3.tar.gz/install/
WORKDIR/install/redis-3.2.3
RUNmake
RUNmakePREFIX=/tool/redis-3.2.3install
#configuretheserver
ADDconf/redis.conf/etc/
#starttheapplication
EXPOSE6379
RUNmkdir-p/app/
ADDstart.sh/app/
WORKDIR/app/
CMD["./start.sh"]
TheMakefileisasfollow:
IMAGE=sillycat/public
TAG=raspberrypi-redis
NAME=raspberrypi-redis
prepare:
wgethttp://download.redis.io/releases/redis-3.2.3.tar.gz-Pinstall/
docker-context:
build:docker-context
dockerbuild-t$(IMAGE):$(TAG).
run:
dockerrun-d-p6379:6379--name$(NAME)$(IMAGE):$(TAG)
debug:
dockerrun-ti-p6379:6379--name$(NAME)$(IMAGE):$(TAG)/bin/bash
clean:
dockerstop${NAME}
dockerrm${NAME}
logs:
dockerlogs${NAME}
publish:
dockerpush${IMAGE}:${TAG}
fetch:
dockerpull${IMAGE}:${TAG}
Commandtostartatthesidedoorperjoblevel.
>#!/bin/sh-ex
#starttheservice
cd/tool/redis-3.2.3/bin
./redis-server/etc/redis.conf
Commandtoconnectfromcommandline.
Verifytheinstallation
>redis-cli-hlocalhost-p6379-akaishi117Aping
PONG
References:
http://andreas-kongelstad.tumblr.com/post/51622770030/part-2-installing-redis-on-raspberry-pi
http://redis.io/topics/cluster-tutorial
https://github.com/antirez/redis
OldBlog