I’ve been using a docker setup with codeceptjs and Selenium for a while and I think that this article explains really good, and imho one of the best articles, on how-to-start on with E2E testing with docker!
So, I’d like to give you some input (feedback) on how to further improve it.
First of all, I’d would say that you can split the services into 3, instead of 2. That would lead to the selenium container, the codeceptjs container and the actual service container. This would lead not only to even more loosely coupled containers but even more loosely coupled apps, as the codeceptjs container could change without even touching the app itself (useful when scaling out a project/-s), the app won’t even know there’s testing dependencies involved.
Second, I would explicitly state a bridged network. This way, you don’t need to map the port to the host, you can simply expose the port (better for CI pipelines as there’s no worries on the availability of the mapped ports in the hosts). This would also lead to the possibility of exposing port 80 in multiple containers and not worry about ports, just about host names (one of the advantages)
I hope you find this useful and maybe you can improve further your docker setup :)