[英]How to properly run docker with Makefile
I have a make file: 我有一个make文件:
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)
when i do make run
i get this error 当我执行
make run
此错误
make: *** No rule to make target `/app', needed by `run'. Stop.
How do I resolve this error 我该如何解决这个错误
Recipe lines must be indented with a real TAB character. 配方行必须使用真实的TAB字符缩进。 In your example, it's likely that line is not indented with a TAB.
在您的示例中,很可能该行没有用TAB缩进。
That means that this line: 这意味着该行:
docker run --entrypoint /bin/bash -i -t -v $(pwd):/app $(APP_NAME)
is treated as a make rule, not a recipe, which is the equivalent of writing: 被视为制作规则,而不是配方,等同于写作:
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)
So when you use make run
, it wants to build the prerequisites /app
and $(APP_NAME)
. 因此,当您使用
make run
,它想要构建先决条件/app
和$(APP_NAME)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.