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?
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.
redis-cli
and execute CONFIG GET *
. See: redis.io/commands/config-get –
Steeplebush 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
.
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
The below steps worked for me
- go to Redis website and download the version you are using https://redis.io/download/ after unzipping, there is redis.conf file modify it
- daemonize no
- bind 0.0.0.0 (Comment original put this )
- set your password requirepass 1782dc476064567822
- start container docker run --name redis --net redis -p 6379:6379 -v /opt/redis/config:/home/redis -v /opt/redis/data:/data/ -d redis:7.0.8-alpine redis-server /home/redis/redis.conf
if the docker is running then you can use the following command to get all the details of docker location, images, containers etc.
docker info
Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): true File Descriptors: 40 Goroutines: 150
you can also use docker -v to get the version details
© 2022 - 2024 — McMap. All rights reserved.
redis.conf
get copied to, in the case of using a custom config? – Capitalistic