mirror of https://github.com/docker/compose.git
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> |
||
---|---|---|
.. | ||
cli | ||
config | ||
__init__.py | ||
bundle_test.py | ||
cli_test.py | ||
container_test.py | ||
network_test.py | ||
parallel_test.py | ||
progress_stream_test.py | ||
project_test.py | ||
service_test.py | ||
split_buffer_test.py | ||
timeparse_test.py | ||
utils_test.py | ||
volume_test.py |