Dockerfile to build a Redis Server container image which can be linked to other containers.
The current release (2.8.14) contains scripts to install Redis Server v2.8.14, and uses the Brightcommerce Ubuntu 14.04 base image. Our version numbers will reflect the version of Redis Server being installed.
Pull the latest version of the image from the Docker Index. This is the recommended method of installation as it is easier to update the image in the future. These builds are performed by the Docker Trusted Build service.
docker pull brightcommerce/redis:latest
or specify a tagged version:
docker pull brightcommerce/redis:2.8.14
Alternately you can build the image yourself:
git clone https://github.com/brightcommerce/docker-redis.git
cd docker-redis
docker build -t="$USER/redis" .
Run the Redis image:
docker run --name redis -d brightcommerce/redis:latest
To test if the Redis server is configured properly, try connecting to the server.
redis-cli -h $(docker inspect --format {{.NetworkSettings.IPAddress}} redis)
If the redis-cli
client isn't installed on the host you can use docker-enter
to shell into the container and run it from there:
sudo docker-enter redis
root@9a34e83ea636:~# redis-cli
127.0.0.1:6379> INFO server
# Server
redis_version:2.8.14
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:b84ccf22550d3c52
redis_mode:standalone
os:Linux 3.16.1+ x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.8.2
process_id:11
run_id:cc85d4e2aefa545699aa4710a56d240688fcd0e8
tcp_port:6379
uptime_in_seconds:330
uptime_in_days:0
hz:10
lru_clock:1058886
config_file:/etc/redis/redis.conf
127.0.0.1:6379> QUIT
root@9a34e83ea636:~# logout
This installation exposes port 6379
.
For data persistence a volume should be mounted at /var/lib/redis
.
The updated run command looks like this:
mkdir -p /opt/redis
docker run -name redis -d -v /opt/redis:/var/lib/redis brightcommerce/redis:latest
This will make sure that the data stored in the database is not lost when the image is stopped and restarted.
To upgrade to newer releases, simply follow this 3 step upgrade procedure.
- Step 1: Stop the currently running image:
docker stop redis
- Step 2: Update the docker image:
docker pull brightcommerce/redis:latest
- Step 3: Start the image:
docker run -name redis -d [OPTIONS] brightcommerce/redis:latest
This repository was based on the work of docker-redis by Sameer Naik.