Reputation: 30995
Context
I want to parallelize the execution of a big number of test suites. To ensure that the results of a given test suite are not compromised by the side effects of previous test suites, I want each test suite to run in a clean, newly initialized environment.
The initialization of the environment is too expensive to be repeated between each test suite. Therefore, I'm thinking to create a Docker image containing the initialized system and to run each test suite inside a new Docker container, started from that image. Since the number of test suites is huge, I would like to run multiple containers (i.e. test suites) on the same host, in parallel.
Unfortunately, in my case the system initialization step produces some application-specific configuration files which refer to the current IP address of the container. Executing a test suite via a subsequent
docker run
command will fail, since the test suite will see a different IP address for the container than the one contained in the application configuration files (the IP address of the container is bumped at every restart).
Upvotes: 2
Views: 1496
Reputation: 5805
I guess that you cannot override redefinition of IP address on restart of the container. We have a similair troubles: our dockerized apps have configs where ip names are hardcoded, so we had a lot of pain after every restart. This is some kind of a service discovery problem.
As a quick fix, you could put simple reconfigure script that updates the IP address in your configs and run it before every testing session.
But in my opinion the architecture of your solution doesn't meet Docker principles. All the immutable objects (binaries, configs etc.) should be combined in a Docker image. Any extra initialization should be performed at the time of ENTRYPOINT
(e.g. in the beginning of runtime). If this is too expensive for you, you can put the initialization inside the image too, but you'll have to hack them in the runtime.
For all I know, there is no way to make the IP of the docker container correspond to the IP of the container with the image being built.
Upvotes: 1