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

Registry tries to cleanup containers whose removal started already #13

Open
dinamic opened this issue Jul 15, 2024 · 2 comments
Open

Registry tries to cleanup containers whose removal started already #13

dinamic opened this issue Jul 15, 2024 · 2 comments

Comments

@dinamic
Copy link

dinamic commented Jul 15, 2024

I'm faced with the following error message and I was wondering why that is.

This is probably a race condition between the --rm option passed to the container upon creation and the docker rm -f the Registry::remove() method calls. Maybe docker tries to automatically remove the container and Registry::remove() requests the same.

Is there a particular reason why the Registry is needed?

Fatal error: Uncaught Symfony\Component\Process\Exception\ProcessFailedException: The command "'docker' 'rm' '-f' 'testcontainer66959b43958a96.16963867'" failed.

Exit Code: 1(General error)

Working directory: /var/www/html

Output:
================


Error Output:
================
Error response from daemon: removal of container testcontainer66959b43958a96.16963867 is already in progress
 in /var/www/html/vendor/symfony/process/Process.php:270
Stack trace:
#0 /var/www/html/vendor/shyim/testcontainer/src/Container/Container.php(230): Symfony\Component\Process\Process->mustRun()
#1 /var/www/html/vendor/shyim/testcontainer/src/Registry.php(36): Testcontainer\Container\Container->remove()
#2 [internal function]: Testcontainer\Registry::cleanup()
#3 {main}
  thrown in /var/www/html/vendor/symfony/process/Process.php on line 270
@shyim
Copy link
Collaborator

shyim commented Jul 16, 2024

Yes looks like a race condition.

The idea behind the registry was to clean up all started test containers which the user forgets to remove.

@dinamic
Copy link
Author

dinamic commented Jul 16, 2024

The idea behind the registry was to clean up all started test containers which the user forgets to remove.

I am aware of a single way to start a container. That's the Container::run() method - it would add --rm, so docker would automatically remove the container upon stopping. Is there another entry point? 🤔

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

No branches or pull requests

2 participants