Bill Brower
Bill Brower

Reputation: 519

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

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

Answers (4)

Adán Escobar
Adán Escobar

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

enter image description here

Upvotes: 6

kish pan
kish pan

Reputation: 19

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

Upvotes: 1

vipcxj
vipcxj

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

Shibashis
Shibashis

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

Related Questions