tox-dev / tox-docker

A tox plugin to run one or more Docker containers during tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: enable running several containers of the same image

ahaeger opened this issue · comments

I have a use-case where I want to boot up two containers of the same image.

Currently, you get an error message stating ValueError: Docker image '<IMAGE NAME>' is specified more than once, so I'm assuming it's not possible.

Can you explain more about what the need is for this, or how you would want to use the two different versions of the same image?

If I remember correctly, my use-case was this: I have an automation tool that sends various requests to an Elasticsearch cluster (e.g. tweaking cluster settings or adding a new index). Part of this tool is also the ability to apply the same requests to multiple clusters. For instance, say you have two deployments of Elasticsearch, in the US and Europe, and you want to update some configuration in both of them identically.

I wanted an integration test for this fan-out logic, to verify that this tool successfully routed the requests to the correct cluster and that the same steps were taken in each. I couldn't mock having different clusters with the same container, as the requests sent aren't necessarily idempotent (if applied once, they might not succeed the second time).

I have some work in progress that'll make this possible and relatively easy. Keep an eye out in the coming weeks for a 2.0 release of tox-docker which will support this, and feel free to weigh in on #65 which describes a change to the config format to support this (among other things)