I have a Dockerfile
to build a Docker image that is based on Alpine Linux. Now I need to install a package as part of this Dockerfile
.
Currently I have:
RUN apk update && \
apk upgrade && \
apk add git
Apparently this is a bad idea, as the result is non-deterministic. Instead, it depends on the point in time at which I build the image, which version of git
is getting installed.
What is the correct way of doing this?
I guess that I have to tell updated
, upgrade
and add
which versions to use, but how do I do this?
I have seen that apk
supports pinning of repositories, but that is not what I want (at least I think so), because I do not want to pin a repository, but a package.
In other words: If git
could be installed via npm
, I'd be able to run:
npm install git@1.9.2
(or whatever version I want to have). What is the equivalent to this for Alpine Linux?