Visitar URL original
Registry tries to cleanup containers whose removal started already · Issue #13 · testcontainers/testcontainers-php · GitHub
Skip to content

Registry tries to cleanup containers whose removal started already #13

Open

Description

@dinamic

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

Activity

  1. shyim commented on Jul 16, 2024

    @shyim
    Collaborator

    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.

  2. dinamic commented on Jul 16, 2024

    @dinamic
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions