Skip to content
This repository was archived by the owner on Jun 30, 2021. It is now read-only.

Commit 89a75c4

Browse files
diemolelgalu
authored andcommitted
Suggesting changes to the README file (#71)
* Suggesting changes to the README file * Fixing formatting and updating version - Fixing formatting issues when using the enumeration - Updating the version used in the documentation to 2.53.0g * Formatting code segments to make list work Following tip shown here: benweet/stackedit#64 to make the numbered list work when in between the items there are code blocks.
1 parent e4d28de commit 89a75c4

File tree

1 file changed

+59
-43
lines changed

1 file changed

+59
-43
lines changed

README.md

Lines changed: 59 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,23 @@ Note SeleniumHQ/docker-selenium project is more useful for building selenium gri
2121

2222
### Run
2323

24-
In general add `sudo` only if needed in your environment and `--privileged` or `-v /dev/shm:/dev/shm` if you really need it like when [Chrome crashes](https://github.com/elgalu/docker-selenium/issues/20) during your high gpu intensive tests.
24+
1. Pull the image and run the container
2525

26-
docker pull elgalu/selenium:2.53.0g
26+
docker pull elgalu/selenium:2.53.0g
2727

28-
docker run --rm -ti --name=grid -p 4444:24444 -p 5920:25900 \
29-
-v /dev/shm:/dev/shm -e VNC_PASSWORD=hola elgalu/selenium:2.53.0g
28+
docker run --rm -ti --name=grid -p 4444:24444 -p 5920:25900 \
29+
-v /dev/shm:/dev/shm -e VNC_PASSWORD=hola elgalu/selenium:2.53.0g
3030

31-
Make sure `docker run` finishes via active wait with below command. This is **mandatory** before start running your tests! Note `grid` is the name of the container:
31+
2. Wait until the grid starts properly before starting the tests _(Optional but recommended)_
3232

33-
docker exec grid wait_all_done 30s
33+
docker exec grid wait_all_done 30s
3434

35-
Selenium should be up and running at http://localhost:4444/wd/hub open the web page to confirm is running but if you are using Mac (OSX) `localhost` won't work! find out the correct IP through `boot2docker ip` or `docker-machine ip default`.
35+
After this, Selenium should be up and running at `http://localhost:4444/wd/hub`. Open the url in your browser to confirm it is running.
36+
If you are using Mac (OSX) `localhost` won't work! Find out the correct IP through `boot2docker ip` or `docker-machine ip default`.
37+
38+
**Notes:**
39+
* Add `sudo` only if needed in your environment
40+
* Add `--privileged` or `-v /dev/shm:/dev/shm` if you really need it. For example when [Chrome crashes](https://github.com/elgalu/docker-selenium/issues/20) during your high gpu intensive tests.
3641

3742
#### Stop
3843
Shutdown gracefully
@@ -41,11 +46,11 @@ Shutdown gracefully
4146
docker stop grid
4247

4348
### OSX
44-
Important, in Mac you need to gather the correct IP as localhost won't work unless you are in the Linux docker host machine:
49+
If you are in Mac, you need to get the correct IP of the docker machine. One of these two commands should work to get it:
4550

4651
docker-machine ip default
4752

48-
Or former:
53+
or former:
4954

5055
boot2docker ip
5156

@@ -74,11 +79,11 @@ Then
7479
ssh -X -p 22222 -o StrictHostKeyChecking=no application@localhost
7580
echo $DISPLAY #=> localhost:10.0
7681

77-
That's is useful for tunneling else you can stick with `docker exec` to get into the instance with a shell:
82+
That's is useful for tunneling, or else you can stick with `docker exec` to get into the instance with a shell:
7883

7984
docker exec -ti grid bash
8085

81-
Supervisor exposes an http server but is not enough to bind the ports via `docker run -p` so in this case you need to FWD ports with `ssh -L`
86+
Supervisor exposes an http server but is not enough to bind the ports via `docker run -p`, so in this case you need to FWD ports with `ssh -L`
8287

8388
ssh -p 22222 -o StrictHostKeyChecking=no -L localhost:29001:localhost:29001 application@localhost
8489

@@ -98,20 +103,24 @@ You can set a custom screen size at docker run time by providing `SCREEN_WIDTH`
98103

99104
### Chrome flavor
100105

101-
This feature was available in previous versions, please go [check here][[2.47.1m]] and:
102-
To configure which Chrome flavor (stable, beta, unstable) you want to use just pass for example `-e CHROME_FLAVOR=beta` to `docker run`. Default is `stable`.
106+
This feature was available in previous versions, please go to [2.47.1m] to use it.
107+
108+
To configure which Chrome flavor you want to use (stable, beta, unstable), just pass `-e CHROME_FLAVOR=beta` to `docker run`. Default is `stable`.
103109

104110
### Firefox version
105111

106-
This feature was available in previous versions, please go [check here][[2.47.1m]] and:
107-
To configure which Firefox version to use first check available versions in the [CHANGELOG](./CHANGELOG.md) then pass for example `-e FIREFOX_VERSION=38.0.6` to `docker run`. Default is the latest number of the available list.
112+
This feature was available in previous versions, please go to [2.47.1m] to use it.
113+
To configure which Firefox version to use, first check available versions in the [CHANGELOG](./CHANGELOG.md). Then pass `-e FIREFOX_VERSION=38.0.6` to `docker run`. Default is the latest number of the available list.
108114

109115
### Record Videos
110116
Step by step guide at [docs/videos.md](./docs/videos.md)
111117

112-
If you create the container with `-e VIDEO=true` it will start recording a video through the vnc connection run upon start but first create a local folder `videos` in your current directory and mount the videos directory for an easy transfer with `-v $(pwd)/videos:/videos`
118+
If you create the container with `-e VIDEO=true` it will start recording a video through the vnc connection run upon start.
119+
It is recommended to create first a local folder `videos` in your current directory, and mount the videos directory for
120+
an easy transfer with `-v $(pwd)/videos:/videos`.
113121

114-
Once your tests are done you can either manually stop the recording via `docker exec grid /bin-utils/stop-video` where *ch* is just the arbitrary container chosen name in `docker run` command. Or simply stop the container and that will stop the video recording automatically.
122+
Once your tests are done you can either manually stop the recording via `docker exec grid /bin-utils/stop-video` where
123+
*grid* is just the arbitrary container chosen name in `docker run` command. Or simply stop the container and that will stop the video recording automatically.
115124

116125
Relevant environment variables to customize it are:
117126

@@ -120,11 +129,11 @@ Relevant environment variables to customize it are:
120129
VIDEO_FILE_EXTENSION=mkv
121130
FFMPEG_CODEC_ARGS=""
122131

123-
It is important to note that `ffmpeg` video recording takes an important amount of CPU usage, even more when a well compressed format like *mkv* is selected. You may want to delegate video recording through `vnc2swf-start.sh` to a separate server process and even delegate compression to a further step or to a cloud service like Youtube.
132+
It is important to note that `ffmpeg` video recording takes an important amount of CPU usage, even more when a well compressed format like *mkv* is selected. You may want to delegate video recording through `vnc2swf-start.sh` to a separate server process and even delegate compression to a further step or to a cloud service like YouTube.
124133

125134
### VNC
126135

127-
When you don't specify a VNC password a random one will be generated. That password can be seeing by grepping the logs:
136+
When you don't specify a VNC password, a random one will be generated. That password can be seeing by grepping the logs:
128137

129138
docker exec grid wait_all_done 30s
130139
#=> ... a VNC password was generated for you: ooGhai0aesaesh
@@ -135,11 +144,11 @@ You can connect to see what's happening
135144

136145
### noVNC
137146

138-
Disabled by default, [noVNC](https://github.com/kanaka/noVNC) provides a browser VNC client so you don't need to install a vnc viewer if you choose so. Note we were using guacamole before.
147+
Disabled by default, [noVNC](https://github.com/kanaka/noVNC) provides a browser VNC client so you don't need to install a vnc viewer if you choose so. *Note:* we were using guacamole before.
139148

140149
Safari Browser already comes with a built-in vnc viewer so this feature is overkill and is disabled by default, just navigate to vnc://localhost:5920 in your Safari browser.
141150

142-
You need to pass the environment variable `-e NOVNC=true` in order to start the noVNC service and will be able to open a browser at [localhost:6080](http://localhost:6080/vnc.html)
151+
You need to pass the environment variable `-e NOVNC=true` in order to start the noVNC service and you will be able to open a browser at [localhost:6080](http://localhost:6080/vnc.html)
143152

144153
docker run --rm -ti --name=grid -p 4444:24444 -p 5920:25900 \
145154
-v /dev/shm:/dev/shm -p 6080:26080 -e NOVNC=true \
@@ -150,7 +159,9 @@ If the VNC password was randomly generated find out with
150159
docker exec grid wait_all_done 30s
151160
#=> ... a VNC password was generated for you: ooGhai0aesaesh
152161

153-
## Chrome crashed
162+
## Issues with Chrome
163+
164+
### Chrome crashed
154165

155166
If your tests crashes in Chrome you may need to increase shm size or simply start your container by sharing `-v /dev/shm:/dev/shm`
156167

@@ -166,14 +177,14 @@ docker exec grid sudo umount /dev/shm
166177
docker exec grid sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=512M tmpfs /dev/shm
167178
```
168179

169-
## Chrome not reachable or timeout after 60 secs
180+
### Chrome not reachable or timeout after 60 secs
170181
In CentOS and apparently since docker 1.10.0 is necessary to disable [sandbox mode](http://www.chromium.org/developers/design-documents/sandbox) through [--no-sandbox](http://peter.sh/experiments/chromium-command-line-switches/#no-sandbox) example client implementation.
171182

172183
The error comes along with this message while starting Chrome:
173184

174185
> Failed to move to new namespace: PID namespaces supported. Network namespace supported, but failed: errno = Operation not permitted
175186
176-
### No Sandbox
187+
#### No Sandbox
177188

178189
ChromeOptions options = new ChromeOptions();
179190
options.addArguments("--no-sandbox");
@@ -191,7 +202,7 @@ However this is now the default of this image, see `CHROME_ARGS="--no-sandbox"`
191202

192203
## Security
193204

194-
Do **NOT** expose your selenium grid to the outside world, e.g. in AWS as selenium doesn't provide auth so if the ports are not firewalled malicious users will use [your selenium grid as a bot net](https://github.com/SeleniumHQ/docker-selenium/issues/147).
205+
Do **NOT** expose your selenium grid to the outside world (e.g. in AWS), because Selenium does not provide auth. Therefore, if the ports are not firewalled malicious users will use [your selenium grid as a bot net](https://github.com/SeleniumHQ/docker-selenium/issues/147).
195206

196207
Put that firewall stuff aside, a file [scm-source.json](./scm-source.json) is included at the root directory of the generated image with information that helps to comply with auditing requirements to trace the creation of this docker image.
197208

@@ -230,14 +241,19 @@ Given docker.io currently allows to push the same tag image twice this represent
230241

231242
You can find all digests sha256 and image ids per tag in the [CHANGELOG](./CHANGELOG.md) so as of now you just need to trust the sha256 in the CHANGELOG. Bullet proof is to fork this project and build the images yourself if security is a big concern.
232243

244+
## Cloud Testing Platforms
245+
233246
### Sauce Labs
234247
To open the Sauce Labs tunnel while starting the docker container pass in the arguments `-e SAUCE_TUNNEL=true -e SAUCE_USER_NAME=leo -e SAUCE_API_KEY=secret` that will also require the tunnel to open successfully, else the container will exit so you can be sure your tunnel is up and running before starting to test.
235248

236249
### BrowserStack
237250
To open the BrowserStack tunnel while starting the docker container pass in the arguments `-e BSTACK_TUNNEL=true -e BSTACK_ACCESS_KEY=secret` that will also require the tunnel to open successfully, else the container will exit so you can be sure your tunnel is up and running before starting to test.
238251

252+
## Additional Uses
253+
239254
### Using Xephyr to redirect X to the docker host
240255
Note the below method gives full access to the docker container to the host machine.
256+
241257
Host machine, terminal 1:
242258

243259
sudo apt-get install xserver-xephyr
@@ -344,9 +360,9 @@ docker stop ${CONTAINER}
344360
docker rm ${CONTAINER}
345361
```
346362
347-
### Step by step build
363+
## Step by step build
348364
349-
#### 1. Build this image
365+
### 1. Build this image
350366
351367
If you git clone this repo locally, i.e. cd into where the Dockerfile is, you can:
352368
@@ -356,20 +372,20 @@ If you prefer to download the final built image from docker you can pull it, per
356372
357373
docker pull elgalu/selenium:2.53.0g
358374
359-
#### 2. Use this image
375+
### 2. Use this image
360376
361-
##### e.g. Spawn a container for Chrome testing:
377+
#### e.g. Spawn a container for Chrome testing:
362378
363-
CH=$(docker run --rm --name=ch -p=127.0.0.1::24444 -p=127.0.0.1::25900 \
379+
CH=$(docker run --rm --name=CH -p=127.0.0.1::24444 -p=127.0.0.1::25900 \
364380
-v /e2e/uploads:/e2e/uploads elgalu/docker-selenium:local)
365381
366-
Note `-v /e2e/uploads:/e2e/uploads` is optional in case you are testing browser uploads on your webapp you'll probably need to share a directory for this.
382+
*Note:* `-v /e2e/uploads:/e2e/uploads` is optional in case you are testing browser uploads on your WebApp, you'll probably need to share a directory for this.
367383
368384
The `127.0.0.1::` part is to avoid binding to all network interfaces, most of the time you don't need to expose the docker container like that so just *localhost* for now.
369385
370-
I like to remove the containers after each e2e test with `--rm` since this docker container is not meant to preserve state, spawning a new one is less than 3 seconds. You need to think of your docker container as processes, not as running virtual machines if case you are familiar with vagrant.
386+
I like to remove the containers after each e2e test with `--rm` since this docker container is not meant to preserve state, spawning a new one is less than 3 seconds. You need to think of your docker container as processes, not as running virtual machines in case you are familiar with vagrant.
371387
372-
A dynamic port will be binded to the container ones, i.e.
388+
A dynamic port will be bound to the container ones, i.e.
373389
374390
# Obtain the selenium port you'll connect to:
375391
docker port $CH 4444
@@ -383,19 +399,19 @@ In case you have RealVNC binary `vnc` in your path, you can always take a look,
383399
384400
./bin/vncview.sh 127.0.0.1:49160
385401
386-
##### e.g. Spawn a container for Firefox testing:
402+
#### e.g. Spawn a container for Firefox testing:
387403
388-
This command line is the same as for Chrome, remember that the selenium running container is able to launch either Chrome or Firefox, the idea around having 2 separate containers, one for each browser is for convenience plus avoid certain `:focus` issues you web app may encounter during e2e automation.
404+
This command line is the same as for Chrome, remember that the selenium running container is able to launch either Chrome or Firefox, the idea around having 2 separate containers, one for each browser is for convenience, plus avoid certain `:focus` issues your WebApp may encounter during e2e automation.
389405
390406
FF=$(docker run --rm --name=ff -p=127.0.0.1::24444 -p=127.0.0.1::25900 \
391407
-v /e2e/uploads:/e2e/uploads elgalu/docker-selenium:local)
392408
393-
##### How to get docker internal IP through logs
409+
#### How to get docker internal IP through logs
394410
395411
CONTAINER_IP=$(docker logs sele10 2>&1 | grep "Container docker internal IP: " | sed -e 's/.*IP: //' -e 's/<.*$//')
396412
echo ${CONTAINER_IP} #=> 172.17.0.34
397413
398-
##### Look around
414+
#### Look around
399415
400416
docker images
401417
#=>
@@ -404,9 +420,9 @@ This command line is the same as for Chrome, remember that the selenium running
404420
elgalu/docker-selenium local eab41ff50f72 About an hour ago 931.1 MB
405421
ubuntu 14.04.2 d0955f21bf24 4 weeks ago 188.3 MB
406422
407-
#### DNS
423+
### DNS
408424
409-
##### How to share the host DNS
425+
#### How to share the host DNS
410426
411427
By default `docker run` sets the DNS to Google ones *8.8.8.8 and 8.8.4.4* however you may need to use your own.
412428
@@ -420,16 +436,16 @@ However this may not work for you and simply want to share the same DNS name res
420436
421437
So `--pid=host` is included to avoid https://github.com/docker/docker/issues/5899 `sudo: unable to send audit message: Operation not permitted`
422438
423-
### Who
424-
Who is using docker-selenium?
439+
## Who is using docker-selenium?
425440
426441
* [Shoov](http://www.gizra.com/content/phantomjs-chrome-docker-selenium-standalone/)
427442
* [smaato](http://blog.smaato.com/automated-end-to-end-testing-with-protractor-docker-jenkins)
428443
* [Algolia](https://github.com/algolia/instantsearch.js/#functional-tests)
429444
* [Nvidia](https://twitter.com/nvidia)
430-
* many more! please ping @elgalu to add you here
445+
* And many more! Please ping @elgalu to add you here.
446+
431447
432-
### Troubleshooting
448+
## Troubleshooting
433449
434450
All output is sent to stdout so it can be inspected by running:
435451

0 commit comments

Comments
 (0)