I use the zenika/alpine-chrome Docker image in one of my projects. Another container connects to it using a web socket, and I have been able to use it successfully.
The problem is that the browser ID (shown below when the container starts) changes each initialization, and I can’t find a good way to fetch or extract this ID.
Here is the excerpt from my docker-compose.yml
file:
....
chromium:
image: zenika/alpine-chrome
command:
[
chromium-browser,
"--headless",
"--disable-gpu",
"--remote-debugging-address=0.0.0.0",
"--remote-debugging-port=9222",
" --remote-allow-origins=*",
"--no-sandbox"
]
cap_add:
- SYS_ADMIN
networks:
- sail
ports:
- '${FORWARD_CHROMIUM_PORT:-9222}:9222'
....
I was hoping that I could do one of the following:
chromium-browser
command to hard code this ID (this is just used for local development)I just discovered this endpoint: :9222/json
, which does get me what I need; it's not as clean as just the ID, but it will work for now.