Reputation: 519
I know that it is possible to pass your own config file but I'd rather edit the handful of values I care about in the default config. I'm having a hard time finding a default redis.conf anywhere though, do I just have to COPY my own into the container?
Upvotes: 32
Views: 45812
Reputation: 4783
docker image has not config file.
"Redis is able to start without a configuration file using a built-in default configuration, however this setup is only recommended for testing and development purposes."
you can download a config file, according your version, here: https://redis.io/docs/management/config/
And you can set it like this:
Dockerfile:
FROM redis:7.2.3
COPY config/redis.conf /usr/local/etc/redis/redis.conf
CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
docker-compose:
version: '3.8'
services:
redis:
image: my-redis:7.2.3
container_name: redis
build:
context: .
dockerfile: Dockerfile
ports:
- 6379:6379
volumes:
- ./data/:/data
Upvotes: 6
Reputation: 19
The below steps worked for me
Upvotes: 1
Reputation: 1038
You can get the example redis config file from github. It just located at root path. Note that select the branch match your version.
Then you can custom the config file base on the example config file above. Then run the command docker run -v /path/to/your/custom/config/redis.conf:/usr/local/etc/redis/redis.conf --name myredis redis redis-server /usr/local/etc/redis/redis.conf
.
Upvotes: 5
Reputation: 8421
The default image from redis does not have a redis.conf.
Here is the link for the image on dockerhub. https://hub.docker.com/_/redis/
You will have to copy it to image or have it mapped on the host using a volume mapping.
Upvotes: 26