Docker error: Unable to locate package git Docker error: Unable to locate package git git git

Docker error: Unable to locate package git


This is happening because the apt repository is not yet updated, it is common practice to clean your apt repositories and tmp files after creating an image, which your base image is probably doing.

To fix this, you are going to want to run apt-get update prior to installing git, it is good practice to combine the update and install command at the same time to bust cache on the update if the install line changes:

RUN apt-get update && apt-get install -y git

Using -y is convenient to automatically answer yes to all the questions.