gpt4 book ai didi

linux - 如何使用 Makefile 正确运行 docker

转载 作者:太空宇宙 更新时间:2023-11-04 12:14:37 24 4
gpt4 key购买 nike

我有一个生成文件:

APP_NAME=sgy-core-bdd/codeception

build: ## Build the container
docker build -t $(APP_NAME) .

run:
docker run --entrypoint /bin/bash -i -t -v $(pwd):/app $(APP_NAME)

当我执行 make run 时出现此错误

make: *** No rule to make target `/app', needed by `run'.  Stop.

如何解决这个错误

最佳答案

配方行必须用真正的 TAB 字符缩进。在您的示例中,该行可能没有使用 TAB 缩进。

这意味着这一行:

docker run --entrypoint /bin/bash -i -t -v $(pwd):/app $(APP_NAME)

被视为 make 规则,而不是食谱,这相当于写:

docker: /app $(APP_NAME)
run: /app $(APP_NAME)
--entrypoint: /app $(APP_NAME)
/bin/bash: /app $(APP_NAME)
-i: /app $(APP_NAME)
-t: /app $(APP_NAME)
-v: /app $(APP_NAME)
$(pwd): /app $(APP_NAME)

因此,当您使用 make run 时,它想要构建先决条件 /app$(APP_NAME)

关于linux - 如何使用 Makefile 正确运行 docker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47823518/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com