Yes. Just mount your redis.conf
over the default with a volume:
redis:
image: redis
volumes:
- ./redis.conf:/usr/local/etc/redis/redis.conf
ports:
- "6379"
Alternatively, create a new image based on the redis image with your conf file copied in. Full instructions are at: https://registry.hub.docker.com/_/redis/
However, the redis image does bind to 0.0.0.0
by default. To access it from the host, you need to use the port that Docker has mapped to the host for you which you find by using docker ps
or the docker port
command, you can then access it at localhost:32678
where 32678 is the mapped port. Alternatively, you can specify a specific port to map to in the docker-compose.yml
.
As you seem to be new to Docker, this might all make a bit more sense if you start by using raw Docker commands rather than starting with Compose.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…