-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Raul edited this page Jul 12, 2023
·
6 revisions
# curl -X POST localhost:8080/proxy
{"port":8081}
# curl localhost:8080/proxy
{"proxyList":[{"port":8081}]}
# curl -X PUT localhost:8080/proxy/8081/har
# curl google.com --proxy localhost:8081
...
# curl localhost:8080/proxy/8081/har
{"log":{"version":"1.2","creator":{"name":"BrowserMob Proxy","version":"2.1.4"...
# curl -X DELETE localhost:8080/proxy/8081
docker run -d -p 127.0.0.1:4444:4444 --name selenium-hub selenium/hub
docker run -d -p 127.0.0.1:8080:8080 --name browsermob-proxy raul72/browsermob-proxy
docker run -d --link selenium-hub:hub --link browsermob-proxy:proxy --name chrome-001 selenium/node-chrome
docker run -d --link selenium-hub:hub --link browsermob-proxy:proxy --name firefox-001 selenium/node-firefox
This way you'll expose proxy API (8080) to host machine but not the proxies.
When you create a proxy instance over the API then browser should use either browsermob-proxy
or proxy
as hostname ("--proxy-server=proxy:8081"
)
See selenium manual: https://github.com/SeleniumHQ/docker-selenium#dev-and-beta-on-the-grid
version: "3.7"
services:
proxy:
image: raul72/browsermob-proxy
ports:
- 8080:8080
- 8081-8581:8081-8581
selenium-hub:
image: selenium/hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
chrome:
image: selenium/node-chrome
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443