skip to Main Content

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:

  1. wsl2 (ubuntu 18.04 distro)
  2. windows 10
  3. docker-for-windows (v20.10.2)

Some help ?

2

Answers


  1. 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

    Login or Signup to reply.
  2. 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, the WORKDIR 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search