Skip to content

chalkchisel/redis

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chalkchisel-docker-redis

Base docker image to run a Redis server

Usage

To create the image quay.io/chalkchisel/redis, execute the following command on the chalkchisel-redis folder:

docker build -t quay.io/chalkchisel/redis .

Running the Redis server

Run the following command to start Redis:

docker run -d -p 6379:6379 quay.io/chalkchisel/redis

The first time that you run your container, a new random password will be set. To get the password, check the logs of the container by running:

docker logs <CONTAINER_ID>

You will see an output like the following:

========================================================================
You can now connect to this Redis server using:

    redis-cli -a 5elsT6KtjrqVtOitprnDm7M9Vgz0MGgu -h <host> -p <port>

Please remember to change the above password as soon as possible!
========================================================================

In this case, 5elsT6KtjrqVtOitprnDm7M9Vgz0MGgu is the password set. You can then connect to Redis:

redis-cli -a 5elsT6KtjrqVtOitprnDm7M9Vgz0MGgu

Done!

Setting a specific password

If you want to use a preset password instead of a random generated one, you can set the environment variable REDISCONF_PASS to your specific password when running the container:

docker run -d -p 6379:6379 -e REDISCONF_PASS="mypass" quay.io/chalkchisel/redis

You can now test your deployment:

redis-cli -a mypass

If you want to disable password authentication, you can set REDISCONF_PASS to **None**:

docker run -d -p 6379:6379 -e REDISCONF_PASS="**None**" quay.io/chalkchisel/redis

Configuring Redis

If you want to pass in any configuration variable to redis, set it as an environment variable with a REDISCONF_ prefix. For example, if you want to set tcp-keepalive 60, execute the following:

docker run -d -p 6379:6379 -e REDISCONF_TCP_KEEPALIVE=60 quay.io/chalkchisel/redis

For a full list of configuration options, check this commented redis.conf file

Configuring Redis as a LRU cache

In order to run Redis as a cache that will delete older entries when the memory fills up provide the following additional environment variables:

docker run -d -p 6379:6379 -e REDISCONF_MAXMEMORY_POLICY="allkeys-lru" -e REDISCONF_MAXMEMORY="256mb" quay.io/chalkchisel/redis

More info at redis.io

Configuring Redis to use AOF

If you want Redis to store data in a volume to prevent data from disappearing should you restart the container, set the following environment variables:

docker run -d -p 6379:6379 -e REDISCONF_APPENDONLY=yes -e REDISCONF_APPENDFSYNC=always quay.io/chalkchisel/redis

Please note that this will impact performance. For a more lightweight persistence by saving every second instead of every instruction, use REDISCONF_APPENDFSYNC=everysec instead. More info at redis.io

by http://www.tutum.co

About

Docker image to run an out-of-the-box redis server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%