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

Commit bbb8ed2

Browse files
author
Leo Gallucci
committed
Include urandom fix that hangs selenium start up
1 parent 89024ec commit bbb8ed2

File tree

4 files changed

+85
-51
lines changed

4 files changed

+85
-51
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## v2.45.0-oracle1 (2015-06-04)
4+
+ Include urandom fix that hangs selenium start up (Matthew Smith)
5+
+ Switch to Oracle Java 8 to test it out (Leo Gallucci)
6+
+ Image tag details:
7+
+ Selenium: v2.45.0 (5017cb8)
8+
+ Chrome: 43.0.2357.81
9+
+ chromedriver: 2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3)
10+
+ Firefox: 38.0
11+
+ Java: 1.8.0_45 HotSpot(TM) 1.8.0_45-b14
12+
+ Timezone: Europe/Berlin
13+
+ Digest: sha256:TBD
14+
+ Image ID: fcaf12794d4311ae5c511cbc5ebc500ff01782b4eac18fe28f994557ebb401fe
15+
316
## v2.45.0-ssh4 (2015-06-04)
417
+ Add option to disable wait for selenium to start (Leo Gallucci)
518
+ Add jq tool for json querying (Leo Gallucci)

Dockerfile

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -79,35 +79,56 @@ RUN echo $TZ | tee /etc/timezone \
7979
# Java7 - OpenJDK JRE headless
8080
# Minimal runtime used for executing non GUI Java programs
8181
#==============================
82+
# Regarding urandom see
83+
# http://stackoverflow.com/q/26021181/511069
84+
# https://github.com/SeleniumHQ/docker-selenium/issues/14#issuecomment-67414070
8285
# RUN apt-get update -qqy \
8386
# && apt-get -qqy install \
8487
# openjdk-7-jre-headless \
88+
# && sed -i 's/securerandom.source=file:\/dev\/urandom/securerandom.source=file:\/dev\/.\/urandom/g' \
89+
# /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/security/java.security \
90+
# && sed -i 's/securerandom.source=file:\/dev\/random/securerandom.source=file:\/dev\/.\/urandom/g' \
91+
# /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/security/java.security \
8592
# && rm -rf /var/lib/apt/lists/*
8693

8794
#==============================
8895
# Java8 - OpenJDK JRE headless
8996
# Minimal runtime used for executing non GUI Java programs
9097
#==============================
91-
RUN apt-get update -qqy \
92-
&& apt-get -qqy install \
93-
openjdk-8-jre-headless \
94-
&& rm -rf /var/lib/apt/lists/*
98+
# Regarding urandom see
99+
# http://stackoverflow.com/q/26021181/511069
100+
# https://github.com/SeleniumHQ/docker-selenium/issues/14#issuecomment-67414070
101+
# RUN apt-get update -qqy \
102+
# && apt-get -qqy install \
103+
# openjdk-8-jre-headless \
104+
# && sed -i 's/securerandom.source=file:\/dev\/urandom/securerandom.source=file:\/dev\/.\/urandom/g' \
105+
# /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security \
106+
# && sed -i 's/securerandom.source=file:\/dev\/random/securerandom.source=file:\/dev\/.\/urandom/g' \
107+
# /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security \
108+
# && rm -rf /var/lib/apt/lists/*
95109

96110
#==================
97111
# Java8 - Oracle
98112
#==================
99-
# RUN apt-get update -qqy \
100-
# && apt-get -qqy install \
101-
# software-properties-common \
102-
# && echo debconf shared/accepted-oracle-license-v1-1 \
103-
# select true | debconf-set-selections \
104-
# && echo debconf shared/accepted-oracle-license-v1-1 \
105-
# seen true | debconf-set-selections \
106-
# && add-apt-repository ppa:webupd8team/java \
107-
# && apt-get update -qqy \
108-
# && apt-get -qqy install \
109-
# oracle-java8-installer \
110-
# && rm -rf /var/lib/apt/lists/*
113+
# Regarding urandom see
114+
# http://stackoverflow.com/q/26021181/511069
115+
# https://github.com/SeleniumHQ/docker-selenium/issues/14#issuecomment-67414070
116+
RUN apt-get update -qqy \
117+
&& apt-get -qqy install \
118+
software-properties-common \
119+
&& echo debconf shared/accepted-oracle-license-v1-1 \
120+
select true | debconf-set-selections \
121+
&& echo debconf shared/accepted-oracle-license-v1-1 \
122+
seen true | debconf-set-selections \
123+
&& add-apt-repository ppa:webupd8team/java \
124+
&& apt-get update -qqy \
125+
&& apt-get -qqy install \
126+
oracle-java8-installer \
127+
&& sed -i 's/securerandom.source=file:\/dev\/urandom/securerandom.source=file:\/dev\/.\/urandom/g' \
128+
/usr/lib/jvm/java-8-oracle/jre/lib/security/java.security \
129+
&& sed -i 's/securerandom.source=file:\/dev\/random/securerandom.source=file:\/dev\/.\/urandom/g' \
130+
/usr/lib/jvm/java-8-oracle/jre/lib/security/java.security \
131+
&& rm -rf /var/lib/apt/lists/*
111132

112133
#=======
113134
# Fonts
@@ -277,12 +298,13 @@ RUN apt-get update -qqy \
277298
#==============================================================================
278299
# java blocks until kernel have enough entropy to generate the /dev/random seed
279300
#==============================================================================
280-
# SeleniumHQ/docker-selenium/issues/14
281-
RUN apt-get update -qqy \
282-
&& apt-get -qqy install \
283-
haveged \
284-
&& service haveged start \
285-
&& update-rc.d haveged defaults
301+
# This fix is not working so commented out.
302+
# SeleniumHQ/docker-selenium/issues/14
303+
# RUN apt-get update -qqy \
304+
# && apt-get -qqy install \
305+
# haveged rng-tools \
306+
# && service haveged start \
307+
# && update-rc.d haveged defaults
286308

287309
#==============
288310
# VNC and Xvfb
@@ -334,8 +356,8 @@ RUN apt-get update -qqy \
334356
#========================================
335357
ENV NORMAL_USER application
336358
ENV NORMAL_GROUP ${NORMAL_USER}
337-
ENV NORMAL_USER_UID 1001
338-
ENV NORMAL_USER_GID 1002
359+
ENV NORMAL_USER_UID 999
360+
ENV NORMAL_USER_GID 999
339361
RUN groupadd -g ${NORMAL_USER_GID} ${NORMAL_GROUP} \
340362
&& useradd ${NORMAL_USER} --uid ${NORMAL_USER_UID} \
341363
--shell /bin/bash --gid ${NORMAL_USER_GID} \

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Note SeleniumHQ/docker-selenium project is more useful for building selenium gri
1616

1717
In general: add `sudo` only if needed in your environment and `--privileged` if you really need it.
1818

19-
sudo docker run --privileged -p 4444:4444 -p 5900:5900 -e VNC_PASSWORD=hola elgalu/selenium:v2.45.0-ssh4
19+
sudo docker run --privileged -p 4444:4444 -p 5900:5900 -e VNC_PASSWORD=hola elgalu/selenium:v2.45.0-oracle1
2020

2121
### Non-privileged
2222

@@ -27,7 +27,7 @@ If your setup is correct, privileged mode and sudo should not be necessary:
2727
-e SCREEN_WIDTH=1920 -e SCREEN_HEIGHT=1080 \
2828
-e VNC_PASSWORD=hola -e WITH_GUACAMOLE=false \
2929
-e SSH_PUB_KEY="$(cat ~/.ssh/id_rsa.pub)" \
30-
elgalu/selenium:v2.45.0-ssh4
30+
elgalu/selenium:v2.45.0-oracle1
3131

3232
Make sure `docker run` finishes with **start.sh all done and ready for testing** else you won't be able to start your tests.
3333
Selenium should be up and running at http://localhost:4470/wd/hub open the web page to confirm is running.
@@ -47,17 +47,17 @@ That's is useful for tunneling else you can stick with `docker exec` to get into
4747
### Option 1 - Use immutable image digests
4848
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:
4949

50-
# e.g. sha256 for tag v2.45.0-ssh4
51-
export SHA=def2d462d0224382c8ac5709ee2b468287d88e6973eb14089925631db8065fbd
50+
# e.g. sha256 for tag v2.45.0-oracle1
51+
export SHA=TBD
5252
docker pull elgalu/selenium@sha256:${SHA}
5353

5454
### Option 2 - Check the Full Image Id
5555

5656
Verify that image id is indeed correct
5757

58-
# e.g. full image id for tag v2.45.0-ssh4
59-
export IMGID=34cffc685e12a021b720c2ea19fe1a48c7d438c129f7859bbae43473e4afc95a
60-
if docker inspect -f='{{.Id}}' elgalu/selenium:v2.45.0-ssh4 |grep ${IMGID} &> /dev/null; then
58+
# e.g. full image id for tag v2.45.0-oracle1
59+
export IMGID=fcaf12794d4311ae5c511cbc5ebc500ff01782b4eac18fe28f994557ebb401fe
60+
if docker inspect -f='{{.Id}}' elgalu/selenium:v2.45.0-oracle1 |grep ${IMGID} &> /dev/null; then
6161
echo "Image ID tested ok"
6262
else
6363
echo "Image ID doesn't match"
@@ -83,7 +83,7 @@ ANYPORT=0
8383
REMOTE_DOCKER_SRV=localhost
8484
CONTAINER=$(docker run -d -p=0.0.0.0:${ANYPORT}:2222 -p=0.0.0.0:${ANYPORT}:4444 \
8585
-p=0.0.0.0:${ANYPORT}:5900 -e SCREEN_HEIGHT=1110 -e VNC_PASSWORD=hola \
86-
-e SSH_PUB_KEY="$(cat ~/.ssh/id_rsa.pub)" elgalu/selenium:v2.45.0-ssh4
86+
-e SSH_PUB_KEY="$(cat ~/.ssh/id_rsa.pub)" elgalu/selenium:v2.45.0-oracle1
8787
8888
# -- Option 2.docker run- Running docker on remote docker server like in the cloud
8989
# Useful if the docker server is running in the cloud. Establish free local ports
@@ -93,7 +93,7 @@ ssh ${REMOTE_DOCKER_SRV} #get into the remote docker provider somehow
9393
# it acts as a jump host so my public key is already on that server
9494
CONTAINER=$(docker run -d -p=0.0.0.0:${ANYPORT}:2222 -e SCREEN_HEIGHT=1110 \
9595
-e VNC_PASSWORD=hola -e SSH_PUB_KEY="$(cat ~/.ssh/authorized_keys)" \
96-
elgalu/selenium:v2.45.0-ssh4
96+
elgalu/selenium:v2.45.0-oracle1
9797
9898
# -- Common: Wait for the container to start
9999
while ! docker logs ${CONTAINER} 2>&1 | grep \
@@ -165,7 +165,7 @@ If you git clone this repo locally, i.e. cd into where the Dockerfile is, you ca
165165
166166
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:
167167
168-
docker pull elgalu/selenium:v2.45.0-ssh4
168+
docker pull elgalu/selenium:v2.45.0-oracle1
169169
170170
#### 2. Use this image
171171

READMELeo.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
## Build
22

3-
docker build -t="elgalu/selenium:v2.45.0-ssh4" . ;echo $?;beep
3+
docker build -t="elgalu/selenium:v2.45.0-oracle1" . ;echo $?;beep
44

55
## Run with shared dir
66

77
docker run --rm --name=ch -p=127.0.0.1:4460:4444 -p=127.0.0.1:5910:5900 \
8-
-v /e2e/uploads:/e2e/uploads elgalu/selenium:v2.45.0-ssh4
8+
-v /e2e/uploads:/e2e/uploads elgalu/selenium:v2.45.0-oracle1
99
docker run --rm --name=ch -p=127.0.0.1:4460:4444 -p=127.0.0.1:5910:5900 \
10-
-v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):$(which docker) elgalu/selenium:v2.45.0-ssh4
10+
-v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):$(which docker) elgalu/selenium:v2.45.0-oracle1
1111

12-
docker run --rm --name=ff -p=127.0.0.1:4461:4444 -p=127.0.0.1:5911:5900 -v /e2e/uploads:/e2e/uploads elgalu/selenium:v2.45.0-ssh4
12+
docker run --rm --name=ff -p=127.0.0.1:4461:4444 -p=127.0.0.1:5911:5900 -v /e2e/uploads:/e2e/uploads elgalu/selenium:v2.45.0-oracle1
1313

1414
## Run without shared dir and bind ports to all network interfaces
1515

@@ -32,12 +32,11 @@
3232
## Run without dir and bind to all interfaces
3333
Note anything after the image will be taken as arguments for the cmd/entrypoint
3434

35-
docker run --rm --name=ch -p=0.0.0.0:8813:8484 -p=0.0.0.0:2222:2222 -p=0.0.0.0:4470:4444 -p=0.0.0.0:5920:5900 -e SCREEN_WIDTH=1800 -e SCREEN_HEIGHT=1110 -e VNC_PASSWORD=hola -e SSH_PUB_KEY="$(cat ~/.ssh/id_rsa.pub)" -e WITH_GUACAMOLE=true elgalu/selenium:v2.45.0-ssh4
35+
docker run --rm --name=ch -p=0.0.0.0:8813:8484 -p=0.0.0.0:2222:2222 -p=0.0.0.0:4470:4444 -p=0.0.0.0:5920:5900 -e SCREEN_WIDTH=1800 -e SCREEN_HEIGHT=1110 -e VNC_PASSWORD=hola -e SSH_PUB_KEY="$(cat ~/.ssh/id_rsa.pub)" -e WITH_GUACAMOLE=true elgalu/selenium:v2.45.0-oracle1
3636

37-
docker run --rm --name=ch -p=4470:4444 -p=5920:5900 -e VNC_PASSWORD=hola elgalu/selenium:v2.45.0-ssh4
38-
docker run --rm --name=ch -p=4470:4444 -p=5920:5900 -e VNC_PASSWORD=hola elgalu/selenium@sha256:def2d462d0224382c8ac5709ee2b468287d88e6973eb14089925631db8065fbd
39-
docker run --rm --name=ch -p=4470:4444 -p=5920:5900 -e VNC_PASSWORD=hola docker.io/elgalu/selenium:v2.45.0-ssh4
40-
docker run --rm --name=ch -p=0.0.0.0:4470:4444 -p=0.0.0.0:5920:5900 --add-host myserver.dev:172.17.42.1 elgalu/selenium:v2.45.0-ssh4
37+
docker run --rm --name=ch -p=4470:4444 -p=5920:5900 -e VNC_PASSWORD=hola elgalu/selenium:v2.45.0-oracle1
38+
docker run --rm --name=ch -p=4470:4444 -p=5920:5900 -e VNC_PASSWORD=hola docker.io/elgalu/selenium:v2.45.0-oracle1
39+
docker run --rm --name=ch -p=0.0.0.0:4470:4444 -p=0.0.0.0:5920:5900 --add-host myserver.dev:172.17.42.1 elgalu/selenium:v2.45.0-oracle1
4140

4241
However adding a custom host IP to server-selenium.local (e.g. bsele ssh config) is more work:
4342

@@ -46,32 +45,32 @@ However adding a custom host IP to server-selenium.local (e.g. bsele ssh config)
4645

4746
vncv localhost:5920 -Scaling=60% &
4847

49-
docker run --rm --name=ff -p=0.0.0.0:4471:4444 -p=0.0.0.0:5921:5900 elgalu/selenium:v2.45.0-ssh4
48+
docker run --rm --name=ff -p=0.0.0.0:4471:4444 -p=0.0.0.0:5921:5900 elgalu/selenium:v2.45.0-oracle1
5049

5150
Automatic builds not working for me right now, maybe there is an issue with docker registry v1 vs v2
5251
https://registry.hub.docker.com/u/elgalu/docker-selenium/builds_history/31621/
5352

5453
## Push version
5554

5655
docker login
57-
docker push docker.io/elgalu/selenium:v2.45.0-ssh4 ;echo $?;beep
58-
docker tag elgalu/selenium:v2.45.0-ssh4 elgalu/selenium:latest
56+
docker push docker.io/elgalu/selenium:v2.45.0-oracle1 ;echo $?;beep
57+
docker tag elgalu/selenium:v2.45.0-oracle1 elgalu/selenium:latest
5958
docker push docker.io/elgalu/selenium:latest
6059

6160
Not working maybe because it has automated builds enabled but then it fails in the cloud but works locally
6261
https://registry.hub.docker.com/u/elgalu/selenium/tags/manage/
6362

64-
docker push elgalu/selenium:v2.45.0-ssh4
65-
docker push elgalu/docker-selenium:v2.45.0-ssh4
66-
docker push docker.io/elgalu/docker-selenium:v2.45.0-ssh4
63+
docker push elgalu/selenium:v2.45.0-oracle1
64+
docker push elgalu/docker-selenium:v2.45.0-oracle1
65+
docker push docker.io/elgalu/docker-selenium:v2.45.0-oracle1
6766

6867
## Pulling
6968

70-
docker pull registry.hub.docker.com/elgalu/selenium:v2.45.0-ssh4
69+
docker pull registry.hub.docker.com/elgalu/selenium:v2.45.0-oracle1
7170

7271
## Pull
7372

74-
docker run -d --name=max -p=0.0.0.0:4411:4444 -p=0.0.0.0:5911:5900 elgalu/selenium:v2.45.0-ssh4
73+
docker run -d --name=max -p=0.0.0.0:4411:4444 -p=0.0.0.0:5911:5900 elgalu/selenium:v2.45.0-oracle1
7574

7675
How to connect through vnc (need a vnc client)
7776

0 commit comments

Comments
 (0)