Selenium cannot find file running in separate container

I have 4 containers running in the same Docker network

  • mongodb
  • our api server
  • a selenium server
  • our tests themselves

I get this error from our test container:

 WebDriverError: File not found: /root/cdt-tests/csv-data/IT-DE-Jasper.csv

However, from my test logs, this file totally the test container.

The problem, I think, is that the selenium server is not looking at the same filesystem as our test container, because they are running in different containers.

What is the best way to solve this problem?

a. Should I try to run them in the same container?

b. Can I somehow get them to share the same filesystem?

c. ?

Just because you are sharing the network doesn't mean you are sharing the volumes, see how to do that In Docker, how can I share files between containers and then save them to an image? as @alex-blex suggested

You may be able to connect the containers using a user-defined network, as explained on Docker's site

If you've already done that, it might be an issue with the path to the file you're using in your test. Perhaps it wants an absolute path, because the containers are considered different entities on the Docker network