You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 30, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+33-21Lines changed: 33 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,12 +19,12 @@ Note SeleniumHQ/docker-selenium project is more useful for building selenium gri
19
19
20
20
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.
21
21
22
-
docker run -p 4444:24444 -p 5920:25900 -v /dev/shm:/dev/shm \
23
-
-e VNC_PASSWORD=hola elgalu/selenium:2.47.1i
22
+
docker run --rm --name=grid -p 4444:24444 -p 5920:25900 \
Make sure `docker run` finishes with **selenium all done and ready for testing** else you won't be able to start your tests. To perform this check programatically please use this command where `ch` is the name of the container:
25
+
Make sure `docker run` finishes with **selenium all done and ready for testing** else you won't be able to start your tests. To perform this check programatically please use this command where `grid` is the name of the container:
Selenium should be up and running at http://localhost:4444/wd/hub open the web page to confirm is running.
30
30
@@ -39,7 +39,7 @@ Include `-X` in ssh command if you want to redirect the started GUI programs to
39
39
40
40
That's is useful for tunneling else you can stick with `docker exec` to get into the instance with a shell:
41
41
42
-
docker exec -ti ch bash
42
+
docker exec -ti grid bash
43
43
44
44
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`
45
45
@@ -57,7 +57,7 @@ To configure which Firefox version to use first check available versions in the
57
57
58
58
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`
59
59
60
-
Once your tests are done you can either manually stop the recording via `docker exec ch /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.
60
+
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.
61
61
62
62
Relevant environment variables to customize it are:
63
63
@@ -68,14 +68,26 @@ Relevant environment variables to customize it are:
68
68
69
69
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.
70
70
71
+
### VNC
72
+
73
+
When you don't specify a VNC password a random one will be generated. That password can be seeing by grepping the logs:
74
+
75
+
docker exec grid grep "was generated for you:" /var/log/sele/vnc-stdout.log
76
+
#=> a VNC password was generated for you: ooGhai0aesaesh
71
77
72
78
### noVNC
73
79
74
80
We are now using https://github.com/kanaka/noVNC instead of guacamole so you can open a browser at [localhost:6080](http://localhost:6080/vnc.html) if you don't want to use your own vnc client. Note Safari Browser comes with a built-in one, just navigate to vnc://localhost:5920
75
81
82
+
You need to pass the environment variable `-e NOVNC=true` in order to start the noVNC service.
83
+
84
+
docker run --rm --name=grid -p 4444:24444 -p 5920:25900 \
85
+
-e NOVNC=true \
86
+
elgalu/selenium:2.47.1j
87
+
76
88
If the VNC password was randomly generated find out with
77
89
78
-
docker exec ch grep "was generated for you:" /var/log/sele/vnc-stdout.log
90
+
docker exec grid grep "was generated for you:" /var/log/sele/vnc-stdout.log
79
91
#=> a VNC password was generated for you: ooGhai0aesaesh
80
92
81
93
## Grid
@@ -85,7 +97,7 @@ You can launch a grid only container via environment variables:
The important part above is `-e CHROME=false -e FIREFOX=false` which tells the docker image not run run default chorme and firefox nodes turning the container into a grid-only one.
91
103
@@ -101,7 +113,7 @@ You can lunch a node only container via environment variables:
101
113
-p 25550:25550 -p 25551:25551 \
102
114
-e GRID=false -e CHROME=true -e FIREFOX=true \
103
115
-v $(pwd)/videos:/videos \
104
-
elgalu/selenium:2.47.1i
116
+
elgalu/selenium:2.47.1j
105
117
106
118
The important part above is `-e GRID=false` which tells the container to be a node-only node, this this case with 2 browsers `-e CHROME=true -e FIREFOX=true` but could be just 1.
107
119
@@ -117,8 +129,8 @@ Alternatively you can increase it inside the container:
117
129
2. increase shm size from default 64mb to something bigger:
118
130
119
131
```sh
120
-
docker execch sudo umount /dev/shm
121
-
docker execch sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=512M tmpfs /dev/shm
132
+
docker execgrid sudo umount /dev/shm
133
+
docker execgrid sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=512M tmpfs /dev/shm
122
134
```
123
135
124
136
## Security
@@ -142,9 +154,9 @@ There are also additional steps you can take to ensure you're using the correct
142
154
143
155
You can simply verify that image id is indeed the correct one.
if docker inspect -f='{{.Id}}' elgalu/selenium:2.47.1i |grep ${IMGID} &> /dev/null; then
157
+
# e.g. full image id for tag 2.47.1j
158
+
export IMGID=TBD
159
+
if docker inspect -f='{{.Id}}' elgalu/selenium:2.47.1j |grep ${IMGID} &> /dev/null; then
148
160
echo "Image ID tested ok"
149
161
else
150
162
echo "Image ID doesn't match"
@@ -154,8 +166,8 @@ You can simply verify that image id is indeed the correct one.
154
166
155
167
Given docker.io currently allows to push the same tag image twice this represent a security concern but since docker >= 1.6.2 is possible to fetch the digest sha256 instead of the tag so you can be sure you're using the exact same docker image every time:
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.
@@ -283,7 +295,7 @@ If you git clone this repo locally, i.e. cd into where the Dockerfile is, you ca
283
295
284
296
If you prefer to download the final built image from docker you can pull it, personally I always prefer to build them manually except for the base images like Ubuntu 14.04.2:
0 commit comments