For executing tests I usually run a separate container with:
docker-compose run --rm web /bin/bash
Where web is a container with django. From a shell I execute py.test from time to time.
In order to be able to reach selenium from a container with django and to allow the browser from selenium container to reach django's liveserver I decided to use "net" parameter which allows containers to share net. So I added it to the yml:
selenium:
image: selenium/standalone-firefox
net: "container:web"
Unfortunately this does not work. I do not see 4444 port in my django container.
It only works if instead of net:"container:web"
I specify an autogenerated container's name, like net:"container:project_web_run_1"
.
Also I tried instead of docker-compose run --rm ....
use docker-compose up --no-deps
changing command
parameter to py.test functional_tests
but that did not work either.
Is this the right of using selenium with containers?