Skip to content
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

cvm: A better way to remove orphans #82

Merged
merged 1 commit into from
Dec 26, 2024
Merged

Conversation

kvinwang
Copy link
Collaborator

In the previous implementation, the cvm ran docker compose up --remove-orphans -d on startup, where the --remove-orphans flag is to remove the containers no longer defined in the compose file after an upgrade.
However, that's not enough. Although --remove-orphans removes the orphans, because it runs after the dockerd has started, the orphan containers would still run for a short period of time before being removed, if its RestartPolicy is always or so.

This PR solves it by temporarily disabling the dockerd from being able to start containers in a hacked way: chmod +x /usr/bin/containerd-shim-runc-v2 before the dockerd starts. And recovering it after the docker compose has removed the orphans.

@kvinwang kvinwang force-pushed the safe-remove-orphans branch from ecc57a3 to 1931ed6 Compare December 26, 2024 00:28
@kvinwang kvinwang force-pushed the safe-remove-orphans branch from 1931ed6 to d45dea1 Compare December 26, 2024 01:27
@kvinwang kvinwang merged commit 601466c into master Dec 26, 2024
1 check passed
@kvinwang kvinwang deleted the safe-remove-orphans branch December 26, 2024 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant