4

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.

hemanth mb
  • 87
  • 4
  • 4
    Does 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
  • 2
    above 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 Answers1

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
  • Have a look at @b0gusb comment above. You can do it using compose – Srini M Dec 10 '19 at 14:27