mirror of
https://github.com/docker/compose.git
synced 2026-07-04 23:32:42 +00:00
The Service.create_container() method fetches a list of the current containers in order to determine the next container number. In doing so, it makes several API calls: one to fetch the list of containers, then one per container in order to inspect it. In some situations it can happen that a container is removed after having been listed: in that case, the call to inspect will get a 404 and raise a NotFound. One situation in which this has been observed is when trying to concurrently create multiple one-off containers for the same service (using `docker-compose run` and a unique `--name`), as described in more detail in gh-5179. This patch adds a unit test that simulates the race between the calls to list and to inspect, and changes Service._next_container_number to skip removed containers instead of blowing up. Fixes gh-5179 Signed-off-by: Alberto Piai <apiai@sensational.ch> |
||
|---|---|---|
| .. | ||
| acceptance | ||
| fixtures | ||
| integration | ||
| unit | ||
| __init__.py | ||
| helpers.py | ||