UNPKG

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