user9124444
user9124444

Reputation:

Extending docker image

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 ?

Upvotes: 0

Views: 781

Answers (2)

mchawre
mchawre

Reputation: 12238

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.

Upvotes: 0

user4093955
user4093955

Reputation:

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

Upvotes: 1

Related Questions