1 | # selenium-standalone server
|
2 |
|
3 | selenium-standalone Server with Chrome and Firefox
|
4 |
|
5 | ## Dockerfile
|
6 |
|
7 | [Dockerfile](./Dockerfile)
|
8 |
|
9 | ## Build image
|
10 |
|
11 | ```
|
12 | docker build -t vvoyer/selenium-standalone . --rm
|
13 | ```
|
14 |
|
15 | ## Use image
|
16 |
|
17 | ```
|
18 | $ docker run -it -p 4444:4444 vvoyer/selenium-standalone
|
19 | ```
|
20 |
|
21 | ### Parameters
|
22 |
|
23 | * `SCREEN_GEOMETRY` Set browser window size
|
24 | * Format: `<WIDTH>x<HEIGHT>x<DEPTH>`
|
25 | * Default: `1024x768x16`
|
26 | * Usage example: set screen size to 1200x1200 with 8bits depth
|
27 | ```
|
28 | $ docker run -it -p 4444:4444 -e SCREEN_GEOMETRY="1200x1200x8" vvoyer/selenium-standalone
|
29 | ```
|
30 |
|
31 | * `DEBUG` Enable selenium-standalone debug messages
|
32 | * Value: `selenium-standalone:*`
|
33 | * Default: `null`
|
34 | * Usage example:
|
35 | * Enable debug when building the image
|
36 | ```
|
37 | $ docker build --build-arg DEBUG=selenium-standalone:* -t vvoyer/selenium-standalone . --rm
|
38 | ```
|
39 | * Enable debug when running the image
|
40 | ```
|
41 | $ docker run -it -p 4444:4444 -e DEBUG="selenium-standalone:*" vvoyer/selenium-standalone
|
42 | ```
|
43 |
|
44 | ### Healthcheck
|
45 |
|
46 | A Docker [healthcheck](https://docs.docker.com/engine/reference/builder/#healthcheck) is defined when the image is built.
|
47 |
|
48 | This defines a _health_ status attached to the running container. It checks that Selenium server _ready_ status is true
|
49 |
|
50 | #### Use cases
|
51 |
|
52 | * Manually check the status of a running `vvoyer/selenium-standalone` container
|
53 |
|
54 | ```
|
55 | docker ps
|
56 | ```
|
57 |
|
58 | Check `STATUS` property, health status is displayed at the end (between parenthesis)
|
59 |
|
60 | * When running the image in [`detached`](https://docs.docker.com/engine/reference/run/#detached--d) mode you want to ensure that the Selenium server is ready before using it.
|
61 |
|
62 | Here is a way to poll check container health status until it's `healthy`:
|
63 |
|
64 | ```
|
65 | # Start container in detached mode, forcing its name to `sel-std`
|
66 | docker run --rm --name=sel-std -d -p 4444:4444 vvoyer/selenium-standalone
|
67 |
|
68 | # Will loop until container `sel-std` (you can also check via container id) health status is exactly `healthy`
|
69 | while ! docker inspect --format='{{json .State.Health}}' sel-std | grep -sq '"healthy"'; do sleep 1; done
|
70 | ```
|
71 |
|
\ | No newline at end of file |