"patch" docker image using docker volume?

60 Views Asked by At

Our base docker image is stable and a bit large (for historical reason). Every time we have a new release we just update a few files in it. So the updated Dockerfile is like following,

FROM base-image
RUN mkdir /tmp/patch -p
COPY patch.tgz /tmp/patch/ # patch.tgz contains the new release files
RUN cd /tmp/patch && tar zxf patch.tgz && bash -e -x ./install.sh
RUN rm /tmp/patch -rf

Because our customer has limited access to the internet, sending the updated docker image file to them is always painful (because of the file size). I am thinking about how to optimize this process.

One method come to my mine is to use docker volume. First, create a docker volume to contain the updated files; second, using docker run --volumes-from patch base, then I just need to send the docker volume to my customer every time we have a new release. Because the docker volume only contains my updated files, the image size is much smaller.

1. docker create -v /patch --name patch some-base
2. docker run --volumes-from patch my-base

I know this may not be the intended use case for docker volume but it seems workable. So can anyone shed some light on it or come up with a better idea for my situation ?

0

There are 0 best solutions below