wiremock-docker icon indicating copy to clipboard operation
wiremock-docker copied to clipboard

Feature request: Drop `VOLUME` definition from `wiremock/wiremock` image

Open sambernet opened this issue 3 years ago • 0 comments

I was very pleased to learn that Wiremock now provides it's own official docker image 🎉

We used our own custom wiremock docker image the last few years, which started out from a fork of the rodolpheche/wiremock docker image (probably just the same as the official image). I now tried to use the official image as a drop-in replacement for our own wiremock base image.

But it turns out there is one crucial difference we added to our own docker image: We deliberately dropped the VOLUME /home/wiremock definition from the Dockerfile.

The reason is that we have derived images from that are purpose-built to mock some specific API each, and to update those (in a CI/CD environment, not locally) the image build just copies the updated mock files into those images as part of the build process. This of course breaks when the image itself already defines a VOLUME for those files, as the old state will be retained on the hosts when the new image version is deployed.

Of course there are ugly hacks and workarounds (like reconfiguring the upstream image to use a different home folder, copy the files to this new home folder instead, then using a tmpfs volume for the now-useless /home/wiremock volume etc) - but all this is not needed to start with, as IMHO there is no upside in defining that VOLUME in your Dockerfile but it creates a lot of problems.

Brandon Mitchell has written a short, clear (and more literate) summary of the pros and cons than I could: https://boxboat.com/2017/01/23/volumes-and-dockerfiles-dont-mix/

Would it be possible to drop that VOLUME /home/wiremock definition from your image?

sambernet avatar Oct 14 '22 13:10 sambernet