我写了这个简单的Makefile来说明我的问题。
$make target
dep
称为依赖项并提取图像docker image list -q $(IMG)
的后续检查未找到我的图片。这是怎么回事,我该如何解决?
IMG := hello-world
.PHONY: target
target: dep
ifeq ($(shell docker image list -q $(IMG)),)
echo "docker image list did not recognize the pull"
endif
.PHONY: dep
dep:
@docker pull $(IMG)
答案 0 :(得分:1)
该测试不是后续。在执行任何规则之前,将其替换到Makefile中。
您可能想在List<Integer> arr = new ArrayList<>();
for (int i=1; i<=n; i++) {
arr.add(sc.nextInt());
}
规则的命令中执行该测试:
target
我们可以将命令更改为只运行target: dep
if test -z "$$(docker image list -q $(IMG))"; then \
echo "docker image list did not recognize the pull" >&2; \
false; \
fi
-如果图像存在,它将返回true状态,否则返回false:
docker image inspect