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

Commit 7d697b3

Browse files
committed
Stop sharing /dev/shm and use --shm-size=1g
1 parent 323e2a8 commit 7d697b3

File tree

10 files changed

+32
-32
lines changed

10 files changed

+32
-32
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ matrix:
4040
- docker
4141
env:
4242
- DOCKER_VERSION="stable"
43-
DOCKER_COMPOSE_VERSION="1.8.1"
43+
DOCKER_COMPOSE_VERSION="1.8.0"
4444
DOCKER_PUSH=true
4545
DOCKER_PUSH_LATEST=true
4646
# Linux with docker:beta/older compose:beta/older
@@ -52,7 +52,7 @@ matrix:
5252
- docker
5353
env:
5454
- DOCKER_VERSION="1.12.2-rc2"
55-
DOCKER_COMPOSE_VERSION="1.8.0"
55+
DOCKER_COMPOSE_VERSION="1.8.1"
5656
# Linux with docker:stable compose:beta/older
5757
- os: linux
5858
language: python
@@ -62,7 +62,7 @@ matrix:
6262
- docker
6363
env:
6464
- DOCKER_VERSION="stable"
65-
DOCKER_COMPOSE_VERSION="1.8.0"
65+
DOCKER_COMPOSE_VERSION="1.8.1"
6666
# Linux with docker:beta/older compose:stable
6767
- os: linux
6868
language: python

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ You will need to run the second `eval` command for every new terminal window.
7272
docker pull elgalu/selenium #upgrades to latest if a newer version is available
7373

7474
docker run -d --name=grid -p 4444:24444 -p 5900:25900 \
75-
-e TZ="US/Pacific" -v /dev/shm:/dev/shm elgalu/selenium
75+
-e TZ="US/Pacific" --shm-size=1g elgalu/selenium
7676

7777
2. Wait until the grid starts properly before starting the tests _(Optional but recommended)_
7878

@@ -105,15 +105,15 @@ Please google those errors first before opening an issue in this project.
105105
# capabilities['marionette'] = False
106106
docker run --rm -ti --name=grid2 -p 4444:24444 -p 5900:25900 \
107107
-e USE_SELENIUM=2 \
108-
-v /dev/shm:/dev/shm elgalu/selenium
108+
--shm-size=1g elgalu/selenium
109109
```
110110

111111
### e.g. Selenium 3 with FF 49.0.1
112112
```sh
113113
# capabilities['marionette'] = True
114114
docker run --rm -ti --name=grid3 -p 4444:24444 -p 5900:25900 \
115115
-e USE_SELENIUM=3 \
116-
-v /dev/shm:/dev/shm elgalu/selenium
116+
--shm-size=1g elgalu/selenium
117117
```
118118

119119
### Docker Compose
@@ -133,7 +133,7 @@ This image is designed to run one test on each docker container but if you still
133133
1. The _(not recommended)_ way is by increasing `MAX_INSTANCES` and `MAX_SESSIONS` which now [defaults](https://github.com/elgalu/docker-selenium/blob/2.53.1a/Dockerfile#L967) to 1.
134134

135135
docker run -d --name=grid -p 4444:24444 -p 5900:25900 \
136-
-v /dev/shm:/dev/shm -e VNC_PASSWORD=hola \
136+
--shm-size=1g -e VNC_PASSWORD=hola \
137137
-e MAX_INSTANCES=20 -e MAX_SESSIONS=20 \
138138
elgalu/selenium
139139

@@ -157,7 +157,7 @@ You can also ssh into the machine as long as `SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa
157157
docker run --rm -ti --name=grid -p=4444:24444 -p=5900:25900 -p=22222:22222 \
158158
-e SSHD=true \
159159
-e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" \
160-
-v /dev/shm:/dev/shm elgalu/selenium
160+
--shm-size=1g elgalu/selenium
161161

162162
Then
163163

@@ -168,7 +168,7 @@ Include `-X` in ssh command if you want to redirect the started GUI programs to
168168
docker run --rm -ti --name=grid -p=4444:24444 -p=5900:25900 -p=22222:22222 \
169169
-e SSHD=true -e SSHD_X11FORWARDING=yes \
170170
-e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" \
171-
-v /dev/shm:/dev/shm elgalu/selenium
171+
--shm-size=1g elgalu/selenium
172172

173173
Then
174174

@@ -189,7 +189,7 @@ You can set a custom screen size at docker run time by providing `SCREEN_WIDTH`
189189
docker pull elgalu/selenium
190190

191191
docker run -d --name=grid -p 4444:24444 -p 5900:25900 \
192-
-v /dev/shm:/dev/shm -e VNC_PASSWORD=hola \
192+
--shm-size=1g -e VNC_PASSWORD=hola \
193193
-e SCREEN_WIDTH=1920 -e SCREEN_HEIGHT=1480 \
194194
elgalu/selenium
195195

@@ -202,7 +202,7 @@ You can control and modify the timezone on a container by using the [TZ](https:/
202202

203203
docker run --rm -ti --name=grid -p 4444:24444 -p 5900:25900 \
204204
-e TZ="US/Pacific" -e VNC_PASSWORD=hola \
205-
-v /dev/shm:/dev/shm elgalu/selenium
205+
--shm-size=1g elgalu/selenium
206206

207207
Examples:
208208

@@ -269,7 +269,7 @@ Safari Browser already comes with a built-in vnc viewer so this feature is overk
269269
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)
270270

271271
docker run --rm -ti --name=grid -p 4444:24444 -p 5900:25900 \
272-
-v /dev/shm:/dev/shm -p 6080:26080 -e NOVNC=true \
272+
--shm-size=1g -p 6080:26080 -e NOVNC=true \
273273
elgalu/selenium
274274

275275
If the VNC password was randomly generated find out with
@@ -283,7 +283,7 @@ If the VNC password was randomly generated find out with
283283

284284
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` or, alternatively, `--shm-size=1g`
285285

286-
docker run ... -v /dev/shm:/dev/shm
286+
docker run ... --shm-size=1g
287287

288288
Alternatively you can increase it inside the container:
289289

@@ -386,7 +386,7 @@ Host machine, terminal 1:
386386
Host machine, terminal 2:
387387

388388
docker run --rm --name=ch -p=4444:24444 \
389-
-v /dev/shm:/dev/shm \
389+
--shm-size=1g \
390390
-e SCREEN_WIDTH -e SCREEN_HEIGHT -e XE_DISP_NUM \
391391
-v /tmp/.X11-unix/X${XE_DISP_NUM}:/tmp/.X11-unix/X${XE_DISP_NUM} \
392392
elgalu/selenium
@@ -468,14 +468,14 @@ So `--pid=host` is included to avoid https://github.com/docker/docker/issues/589
468468
Full example using `--net=host` and `--pid=host` but for this to work in OSX you need the latest docker mac package, upgrade if you haven't done so in the last month.
469469

470470
docker run -d --name=grid --net=host --pid=host \
471-
-v /dev/shm:/dev/shm -e SELENIUM_HUB_PORT=4444 \
471+
--shm-size=1g -e SELENIUM_HUB_PORT=4444 \
472472
elgalu/selenium
473473
docker exec grid wait_all_done 30s
474474
./test/python_test.py
475475

476476
#### DNS example
477477

478-
docker run -d --net=host --pid=host --name=grid -v /dev/shm:/dev/shm elgalu/selenium
478+
docker run -d --net=host --pid=host --name=grid --shm-size=1g elgalu/selenium
479479
docker exec grid wait_all_done 30s
480480

481481
## Who is using docker-selenium?

docs/hub_and_nodes.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Chrome will also attach to the `host` network interface.
3030
-e GRID=false -e CHROME=true -e FIREFOX=false \
3131
-e VNC_START=false -e PICK_ALL_RANDMON_PORTS=true \
3232
-e SELENIUM_HUB_PORT=4444 \
33-
-v /dev/shm:/dev/shm \
33+
--shm-size=1g \
3434
elgalu/selenium
3535

3636
![docker-selenium-chrome-node](../images/chrome_grid_console.png)
@@ -39,7 +39,7 @@ Chrome will also attach to the `host` network interface.
3939
-e GRID=false -e CHROME=true -e FIREFOX=false \
4040
-e VNC_START=false -e PICK_ALL_RANDMON_PORTS=true \
4141
-e SELENIUM_HUB_PORT=4444 \
42-
-v /dev/shm:/dev/shm \
42+
--shm-size=1g \
4343
elgalu/selenium
4444

4545
### Firefox
@@ -49,7 +49,7 @@ Firefox will also attach to the host machine network interface.
4949
-e GRID=false -e CHROME=false -e FIREFOX=true \
5050
-e VNC_START=false -e PICK_ALL_RANDMON_PORTS=true \
5151
-e SELENIUM_HUB_PORT=4444 \
52-
-v /dev/shm:/dev/shm \
52+
--shm-size=1g \
5353
elgalu/selenium
5454

5555
![docker-selenium-firefox-node](../images/firefox_grid_console.png)
@@ -58,7 +58,7 @@ Firefox will also attach to the host machine network interface.
5858
-e GRID=false -e CHROME=false -e FIREFOX=true \
5959
-e VNC_START=false -e PICK_ALL_RANDMON_PORTS=true \
6060
-e SELENIUM_HUB_PORT=4444 \
61-
-v /dev/shm:/dev/shm \
61+
--shm-size=1g \
6262
elgalu/selenium
6363

6464
### Wait

docs/hub_and_nodes_alternatives.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The placeholder `{{CONTAINER_IP}}` will be turned into the IP address of the con
4848
-e VNC_START=false -e PICK_ALL_RANDMON_PORTS=true \
4949
-e SELENIUM_HUB_PORT=4444 -e SELENIUM_HUB_HOST="hub.seleniums" \
5050
-e SELENIUM_NODE_HOST="{{CONTAINER_IP}}" \
51-
-v /dev/shm:/dev/shm \
51+
--shm-size=1g \
5252
elgalu/selenium
5353

5454
![docker-selenium-chrome-node](../images/chrome_grid_console.png)
@@ -58,7 +58,7 @@ The placeholder `{{CONTAINER_IP}}` will be turned into the IP address of the con
5858
-e VNC_START=false -e PICK_ALL_RANDMON_PORTS=true \
5959
-e SELENIUM_HUB_PORT=4444 -e SELENIUM_HUB_HOST="hub.seleniums" \
6060
-e SELENIUM_NODE_HOST="{{CONTAINER_IP}}" \
61-
-v /dev/shm:/dev/shm \
61+
--shm-size=1g \
6262
elgalu/selenium
6363

6464
### Firefox
@@ -69,7 +69,7 @@ Firefox will also attach to the `seleniums` network interface.
6969
-e VNC_START=false -e PICK_ALL_RANDMON_PORTS=true \
7070
-e SELENIUM_HUB_PORT=4444 -e SELENIUM_HUB_HOST="hub.seleniums" \
7171
-e SELENIUM_NODE_HOST="{{CONTAINER_IP}}" \
72-
-v /dev/shm:/dev/shm \
72+
--shm-size=1g \
7373
elgalu/selenium
7474

7575
![docker-selenium-firefox-node](../images/firefox_grid_console.png)
@@ -79,7 +79,7 @@ Firefox will also attach to the `seleniums` network interface.
7979
-e VNC_START=false -e PICK_ALL_RANDMON_PORTS=true \
8080
-e SELENIUM_HUB_PORT=4444 -e SELENIUM_HUB_HOST="hub.seleniums" \
8181
-e SELENIUM_NODE_HOST="{{CONTAINER_IP}}" \
82-
-v /dev/shm:/dev/shm \
82+
--shm-size=1g \
8383
elgalu/selenium
8484

8585
### Wait
@@ -133,7 +133,7 @@ Port numbers are completely arbitrary, VNC port will be `5940` and Selenium node
133133
-e SELENIUM_HUB_HOST="{{CONTAINER_IP}}" \
134134
-e SELENIUM_HUB_PORT=4444 \
135135
-e SELENIUM_NODE_HOST="{{CONTAINER_IP}}" \
136-
-v /dev/shm:/dev/shm \
136+
--shm-size=1g \
137137
elgalu/selenium && docker exec node_ch wait_all_done 30s
138138

139139
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.
@@ -149,5 +149,5 @@ Port numbers are completely arbitrary, VNC port will be `5940` and Selenium node
149149
-e SELENIUM_HUB_HOST="{{CONTAINER_IP}}" \
150150
-e SELENIUM_HUB_PORT=4444 \
151151
-e SELENIUM_NODE_HOST="{{CONTAINER_IP}}" \
152-
-v /dev/shm:/dev/shm \
152+
--shm-size=1g \
153153
elgalu/selenium && docker exec node_ff wait_all_done 30s

docs/videos.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Pull image
1111
Run a new grid
1212

1313
docker run --rm --name=grid -p 4444:24444 -p 5920:25900 \
14-
-v /dev/shm:/dev/shm -e VNC_PASSWORD=hola \
14+
--shm-size=1g -e VNC_PASSWORD=hola \
1515
-e VIDEO=true elgalu/selenium
1616

1717
### Wait

images/grid2_console.png

7 Bytes
Loading

images/grid3_console.png

-1 Bytes
Loading

misc/misc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Miscellaneous internal notes, do not read!
33
## Build
44

55
time (docker build -t elgalu/selenium . ;echo $?;beep)
6-
docker run --rm -ti --name=local -e SELENIUM_HUB_PORT=5555 -p=5555:5555 -p=5900:25900 -e VIDEO=true -e VNC_PASSWORD=no -v /dev/shm:/dev/shm elgalu/selenium
6+
docker run --rm -ti --name=local -e SELENIUM_HUB_PORT=5555 -p=5555:5555 -p=5900:25900 -e VIDEO=true -e VNC_PASSWORD=no --shm-size=1g elgalu/selenium
77

88
### Wait
99
Wait and get versions
@@ -25,7 +25,7 @@ Push setup, first time only:
2525

2626
Build a grid with extra nodes
2727

28-
docker run --rm --name=local -p 4444:24444 -p 5900:25900 -v /dev/shm:/dev/shm -e VNC_PASSWORD=hola elgalu/selenium
28+
docker run --rm --name=local -p 4444:24444 -p 5900:25900 --shm-size=1g -e VNC_PASSWORD=hola elgalu/selenium
2929

3030
docker run --rm --name=node -e DISP_N=13 -e SSHD_PORT=22223 -e SUPERVISOR_HTTP_PORT=29003 -e VNC_PORT=25903 -e SELENIUM_NODE_CH_PORT=25330 -e SELENIUM_NODE_FF_PORT=25331 -e GRID=false -e CHROME=true -e FIREFOX=true --net=container elgalu/selenium
3131

test/script_scenario_basic

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export MOCK_SERVER_PORT=$(get_mock_port)
5050
docker run --name=grid -d -e VIDEO=true \
5151
-e MOCK_SERVER_HOST="d.host.loc.dev" \
5252
-e MOCK_SERVER_PORT \
53-
-v /dev/shm:/dev/shm \
53+
--shm-size=1g \
5454
selenium
5555
# -v /var/run/dbus:/var/run/dbus \
5656

@@ -79,7 +79,7 @@ docker run --name=grid3 -d -e VIDEO=true \
7979
-e MOCK_SERVER_HOST="d.host.loc.dev" \
8080
-e MOCK_SERVER_PORT \
8181
-e USE_SELENIUM="3" \
82-
-v /dev/shm:/dev/shm \
82+
--shm-size=1g \
8383
selenium
8484

8585
sleep 0.5 && docker logs grid3

test/script_scenario_node_dies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ docker rm -vf grid_mock || true
4545
docker run --name=mynodes -d \
4646
-e FIREFOX=false \
4747
-e SELENIUM_NODE_CH_PORT -p ${SELENIUM_NODE_CH_PORT}:${SELENIUM_NODE_CH_PORT} \
48-
-v /dev/shm:/dev/shm \
48+
--shm-size=1g \
4949
selenium
5050
# -v /var/run/dbus:/var/run/dbus \
5151

0 commit comments

Comments
 (0)