简体   繁体   English

如何找到用于启动容器的 docker-compose.yml?

[英]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 不会保持状态来管理容器的另一面是,它也并不真正知道或关心您是否手动停止容器。

  • Find the image using docker ps -a使用docker ps -a查找图像
  • Then inspect the image docker image history --no-trunc image_name然后检查镜像docker image history --no-trunc image_name

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 docker-compose.yml在多个VM上启动容器 - docker-compose.yml to start containers on multiple VM's 在docker-compose.yml中了解容器的主机名 - Understanding Hostname of Containers in docker-compose.yml 如何从 docker-compose.yml 运行命令来启动 couchdb - How to run commands from docker-compose.yml to start couchdb 如何在Docker撰写文件(docker-compose.yml)中链接容器? - How do I link containers in a docker compose file (docker-compose.yml)? 如何在全球范围内显示由 docker-compose 创建的所有正在运行的容器,而不考虑 docker-compose.yml - How to show all running containers created by docker-compose, globally, regardless of docker-compose.yml 用一个 docker-compose.yml 启动两个 wikijs 容器,并通过 traefik 分离数据库(postgres) - Start two wikijs containers with one docker-compose.yml and seperate database (postgres) through traefik 这个用于启动traefix,wordpress和mariadb容器的docker-compose.yml文件怎么了? - What's wrong with this docker-compose.yml file to start traefix, wordpress and mariadb containers? 如何链接两个用两个不同的 docker-compose.yml 生成的 docker 容器 - How to link two docker containers which are spawned with two different docker-compose.yml 如何使用 docker-compose.yml 而不是运行命令来配置这些 docker 容器? - How can I configure these docker containers using a docker-compose.yml instead of a run command? 如何在 docker 桌面中重命名 docker-compose.yml 容器组? - How can I rename docker-compose.yml containers group in docker desktop?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM