What is the location of redis.conf in official docker image?
Asked Answered
R

5

29

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?

Ruth answered 24/5, 2016 at 0:17 Comment(0)
C
24

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.

Chilblain answered 24/5, 2016 at 2:49 Comment(4)
What folder should the redis.conf get copied to, in the case of using a custom config?Capitalistic
@Capitalistic in order to use custom config you need to copy to /usr/local/etc/redis/redis.confSigh
If you need access to the configuration of a running Redis instance, I suggest to log into the container. Then run redis-cli and execute CONFIG GET *. See: redis.io/commands/config-getSteeplebush
Use this command => redis-cli CONFIG GET "*"Nalley
B
4

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.

Basham answered 16/7, 2020 at 3:6 Comment(1)
this is not working for me.Anorthite
A
3

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

enter image description here

Agnew answered 11/12, 2023 at 13:25 Comment(0)
A
2

The below steps worked for me

  1. go to Redis website and download the version you are using https://redis.io/download/ after unzipping, there is redis.conf file modify it
  2. daemonize no
  3. bind 0.0.0.0 (Comment original put this )
  4. set your password requirepass 1782dc476064567822
  5. 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
Afrikander answered 25/1, 2023 at 9:30 Comment(0)
P
0

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

Proposal answered 25/2, 2017 at 13:53 Comment(1)
I can't find out relation of your response with this question !??!Dinh

© 2022 - 2024 — McMap. All rights reserved.