Skip to content

Shutdown tasks #607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
justinmoon opened this issue Jun 5, 2019 · 5 comments
Closed

Shutdown tasks #607

justinmoon opened this issue Jun 5, 2019 · 5 comments
Labels
meta: stale This issue/PR is stale and will be closed soon type: feature request New feature or request

Comments

@justinmoon
Copy link

There doesn't seem to be a way to run scripts on container shutdown. I was running a database that was corrupted between restarts. I assume the process must have been killed before it could properly shutdown, but am not sure.

It would be nice if I could run a little bash script on shutdown that could gracefully stop this service.

@justinmoon
Copy link
Author

justinmoon commented Jun 5, 2019

I tried adding a script as a CMD in the dockerfile which could trap kill signals (demo

It works locally (to test I change the CMD to run a script that just prints on a loop: while true; do echo "hello"; sleep 1; done)

But when I attempt to build a GitPod workspace I get an error: Error while adding GitPod layer

I mention this because I'm happy to use a hack like this for a while, but I just can't figure out how to get it to work ...

@meysholdt
Copy link
Member

Hi Justin!

Thx for bringing this up. Your demo link, unfortunately, is a 404.

I agree that it makes sense to have shutdown hooks. Using traps seems like a good workaround.

Can you say which database you used and which command the database would have required to run for a clean shutdown?

@gjsjohnmurray
Copy link

I too have a case where I'd like to run a command during container stop, so I can close down a database cleanly and avoid recovery steps being triggered on subsequent container start.

@stale
Copy link

stale bot commented Mar 18, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Mar 18, 2021
@stale stale bot closed this as completed Mar 29, 2021
@svenefftinge
Copy link
Member

duplicate of #3966

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta: stale This issue/PR is stale and will be closed soon type: feature request New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants