Docker error: Unable to locate package git

心不动则不痛 提交于 2019-12-03 02:06:58
Michael

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!