In a Dockerfile where we build an image for our python projects , we have a line like this to upgrade pip to latest version:
RUN pip install --upgrade pip
This has been working well for a while, but recently the image build started to fail because we are using python 3.6.1 and latest version of pip (21.1) now requires python >= 3.6.2, otherwise you get an "ImportError: cannot import name NoReturn", see https://github.com/psf/black/issues/1666
Besides upgrading our Python version to fix this issue, I was wondering if we really should be running this command to upgrade latest version in a Dockerfile context, because when doing this we don't get a reproducible image anymore, since the pip version will continue to move, and this goes against Docker concept of reproducible environments.
So, should we specify the exact pip version to keep a reproducible build, even if that means that at some point it will be outdated? Or is there another option to ensure that our image will continue to work when a new pip version is released?