[英]How to find the docker-compose.yml that used to start containers?
I want to stop some docker containers through a docker-compose.yml start.我想通过docker-compose.yml start 停止一些docker容器。
But I don't know where is the docker-compose.yml that used to start these containers.但是我不知道用于启动这些容器的 docker-compose.yml在哪里。
How to find the docker-compose.yml through containers?如何通过容器找到docker-compose.yml?
Thanks.谢谢。
It's not persisted anywhere;它不会在任何地方持久存在; certainly an individual container doesn't know whether it was started through Docker Compose, the
docker run
CLI, or some other path.当然,单个容器不知道它是通过 Docker Compose、
docker run
CLI 还是其他路径启动的。 If you can't find (1) or otherwise locate the docker-compose.yml
file then you can't use Docker Compose to manage the container.如果您找不到(1) 或以其他方式找到
docker-compose.yml
文件,那么您将无法使用 Docker Compose 来管理容器。
That having been said, once Docker Compose starts a container, it's an ordinary container, so you can use docker ps
to find it and docker stop; docker rm
话虽如此,一旦 Docker Compose 启动了一个容器,它就是一个普通的容器,所以你可以使用
docker ps
找到它并docker stop; docker rm
docker stop; docker rm
to clean it up, just like any other container. docker stop; docker rm
来清理它,就像任何其他容器一样。 The flip side of Compose not keeping the state to manage containers if you've lost its YAML file is that it also doesn't really know or care if you stop containers by hand.如果您丢失了 YAML 文件,Compose 不会保持状态来管理容器的另一面是,它也并不真正知道或关心您是否手动停止容器。
docker ps -a
docker ps -a
查找图像docker image history --no-trunc image_name
docker image history --no-trunc image_name
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.