I have the following dockerfile:
FROM debian:buster
#Configure apt to look at my Debian repository
COPY ./apt /etc/apt
#Install the software into the image
RUN apt-get update && apt-get -V -y dist-upgrade && apt-get -V -y --allow-unauthenticated --no-install-recommends --allow-downgrades install -f business=1.1-0
ENTRYPOINT ["/usr/sbin/main.sh"]
CMD []
So basically it installs package “business” from version 1.1-0 I have a problem with docker cache, I’m pushing a new code change of package “business” with the same version (1.1-0) [yes I’m overriding versions…] and docker cache is not smart enough to pull the new changed .deb.
It uses the cached layer without my code change :frowning: As workaround, I build with --no-cache but I don’t like this solution because I’m losing the caching mechanism.
Any way to solve that? Can I build with no cache only from specific layer?
Yes you can,
option a)
RUN apt-get update && apt-get -V -y dist-upgrade
RUN head -c 23 /dev/urandom > /.randfile && apt-get -V -y --allow-unauthenticated --no-install-recommends --allow-downgrades install -f business=1.1-0
option b)
--no-cache
option of docker-compose
and docker build
( e.g. do the upgrades in a first pipeline , push as someimage:baseimage,
then use FROM someimage:baseimage
in the next stageoption c)