I want to stop my docker container exactly after some duration like after 40 minutes from the time it's up. Is there any way in docker-compose to achieve this.
Asked
Active
Viewed 1,895 times
4
-
4Does this answer your question? [How to limit \`docker run\` execution time?](https://stackoverflow.com/questions/48299352/how-to-limit-docker-run-execution-time) – Shubham Dec 10 '19 at 07:25
-
2above link explains --stop-timeout .thats related to how docker handles your container when docker stop is executed. – Srini M Dec 10 '19 at 09:21
1 Answers
0
You can see that this feature is getting discussed here. However, you can try this one. Uses docker commands to achieve this.

Srini M
- 495
- 2
- 9
-
I am using docker-compose to run the image in container, all the required configurations are added in "docker-compose.yml". I will execute the following command "docker-compose up -d" where the "yml" file is located to run the build image. The [link1](https://github.com/moby/moby/issues/1905) and [link2](https://github.com/moby/moby/issues/1905#issuecomment-427014386) you have shared might help when we run using "docker run" command. – hemanth mb Dec 10 '19 at 12:38
-