I want to stop some docker containers through a docker-compose.yml start.
But I don't know where is the docker-compose.yml that used to start these containers.
How to find the docker-compose.yml through containers?
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. 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.
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 stop; docker rm
to clean it up, just like any other container. 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.
docker ps -a
docker image history --no-trunc image_name
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.