Docker build失败,"failed to compute cache key: " /tmp/mvnrepository.tgz " not found: not found"



我正在Dockerfile上进行docker构建,它在以下步骤中失败

COPY /tmp/mvnrepository.tgz /opt/mvnrepository.tgz

我尝试过用docker build-f Dockerfile指定文件名,但还是出现了错误。我试着从父目录构建它,其中包含dockerfile的路径和如下所示的文件名,但我仍然得到错误

cd /home/parentdirectory
docker build . -f /childdirectory/Dockerfile

问题是/home/parentdirectory是您的docker构建上下文,而/tmp/mvnrepository.tgz不在其中。将文件复制到/home/parentdirectory中,然后在Dockerfile中相应地更改COPY的第一个参数。

COPY /home/parentdirectory/mvnrepository.tgz /opt/mvnrepository.tgz

最新更新