[英]Makefile for running docker container with pseudo TTY
I have a following Makefile:我有以下 Makefile:
start: delete-network create-network start-container delete-network
start-container:
docker run -it --rm --network docky docky bash
create-network:
docker network create docky
delete-network:
docker network remove docky 2> /dev/null || true
Unfortunately when I call make start
, delete-network
task is ignored after I exit from cotainer.不幸的是,当我调用
make start
, delete-network
任务在我退出 cotainer 后被忽略。 How can I execute all tasks?如何执行所有任务?
If running the container and cleaning up is the goal, this will do it:如果运行容器并清理是目标,则可以这样做:
start: delete-network create-network start-container
start-container:
docker run -it --rm --network alpine alpine sh; docker network remove alpine
create-network:
docker network create alpine
delete-network:
docker network remove alpine 2> /dev/null || true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.