I want to extend the existing redis:6.0-alpine image from docker-hub and want to add my configuration file in the container.
For that I’ve created this dockerfile
FROM redis:6.0-alpine
WORKDIR .
COPY redis.master.conf ./config/redis.conf
but when building a container from this image, there is nothing copyed at the specified location.
Setup:
- wsl2 (ubuntu 18.04 distro)
- windows 10
- docker-for-windows (v20.10.2)
Some help ?
2
Answers
Just tested myself, and it’s copied without issues.
Where are you trying to look for the file? Notice the entry directory of this image is not
/
, it’s/data
, hence your file is on/data/etc/redis.conf
This is because
WORKDIR
is set to.
in your dockerfile, which means current working directory. If you look at the official dockerfile of redis:6.0-alpine, theWORKDIR
is set to/data
.Hence according to your dockerfile, you are copying the
redis.master.conf
file to./
which means/data
. Please check your file at/data/etc/redis.conf
. I tried this at my end and can confirm this behavior.If you want to copy it at
/etc/redis.conf
then remove./
before/etc
.