-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support to spin up docker in a sibling container (from when Ka… #1603
Adding support to spin up docker in a sibling container (from when Ka… #1603
Conversation
…rate itself is containerized)
if the following is used: An hostname that is different from localhost will be used by the Docker Target but also by the WebSocket URL. If Also solves for https://stackoverflow.com/questions/59426102/karateui-how-to-add-host-header-into-addoptions-during-the-driver-configurati by including the See following for the implemented workarounds:
|
Should be obvious but putting it here for future Googlers - you still need to solve (on your own) the strategy for deploying Karate in a container and providing it access to launch a sibling container. There are several security implications you will need to navigate but the solution that seems to be more accepted is to include the socket of the host into the container where your Karate is running to give it control of the host docker. Few useful links: |
@joelpramos the docker part of the build seems to have failed |
…f the socket URL is localhost. If the host/port are localhost no harm no foul. If we're dealing with a remote host (e.g. Device Farm) it shouldn't be localhost to begin with.
@joelpramos is this ready to merge ? |
@ptrthomas I just need to change the naming of the properties I introduced (e.g. remote target or something instead of sibling container). Also need to re read the documentation to check whether there was a use case I didn't consider but I'm pretty certain this is fine as the new code is all conditional on that new property. |
I will get it done today |
…will present regardless even if you are running your Chrome container somewhere else as found by some stackoverflow answers. This parameter will give control to override the initial header send to the web socket that gets the socket remote URL
… event test scripts are meant to not stop the container immediately but to allow implementation of mechanisms for cleanup of containers on a regular basis)
@ptrthomas ready for merge. There is a change for the way the ports are exposed. Instead of relying on the operative system to find us a free port and expose that in the container, we're now relying on docker to expose in a random available port and grabbing that port for use. This enables the use case of sibling containers (as to avoid port clashes). In addition there are a few optional parameters for when using a chrome in a remote local (e.g. sibling docker container, chrome hosted in another machine etc.). There are some limitations described here chromedp/chromedp#505 when the host is not localhost. The workaround is applied when setting the property Using Sample configuration the docker target: PS: I only tested with Chrome... I assume that if the others don't use that HOST header property than no harm no foul but in any case the previous behavior did not change unless you are using these new optional parameters. |
Description
Thanks for contributing this Pull Request. Make sure that you submit this Pull Request against the
develop
branch of this repository, add a brief description, and tag the relevant issue(s) and PR(s) below.