Skip to content

Commit 459ebc2

Browse files
authored
Workaround to mount docker.sock (SeleniumHQ#1505) [deploy]
* Workaround to mount docker.sock * Updating docs to mount docker.sock
1 parent 281e5c4 commit 459ebc2

12 files changed

+221
-94
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ docker: base generate_docker
121121
generate_standalone_docker:
122122
cd ./StandaloneDocker && ./generate.sh $(TAG_VERSION) $(NAMESPACE) $(AUTHORS)
123123

124-
standalone_docker: base generate_standalone_docker
124+
standalone_docker: docker generate_standalone_docker
125125
cd ./StandaloneDocker && docker build $(BUILD_ARGS) -t $(NAME)/standalone-docker:$(TAG_VERSION) .
126126

127127
generate_standalone_firefox:

NodeDocker/Dockerfile.txt

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
USER root
2+
3+
#==============
4+
# Socat to proxy docker.sock when mounted
5+
#==============
6+
RUN apt-get update -qqy \
7+
&& apt-get -qqy install socat \
8+
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
9+
110
USER 1200
211

312
#========================
@@ -6,9 +15,10 @@ USER 1200
615

716
EXPOSE 4444
817

9-
COPY start-selenium-grid-node-docker.sh \
18+
COPY start-selenium-grid-docker.sh \
1019
config.toml \
20+
start-socat.sh \
1121
/opt/bin/
1222

13-
COPY selenium-grid-node-docker.conf /etc/supervisor/conf.d/
23+
COPY selenium-grid-docker.conf /etc/supervisor/conf.d/
1424

NodeDocker/config.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ configs = [
1212
# Linux could use --net=host in the `docker run` instruction or 172.17.0.1 in the URI below.
1313
# To have Docker listening through tcp on macOS, install socat and run the following command
1414
# socat -4 TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock
15-
url = "http://host.docker.internal:2375"
15+
url = "http://127.0.0.1:2375"
1616
# Docker image used for video recording
1717
video-image = "selenium/video:ffmpeg-4.3.1-20220131"
1818

NodeDocker/selenium-grid-node-docker.conf renamed to NodeDocker/selenium-grid-docker.conf

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
; Documentation of this file format -> http://supervisord.org/configuration.html
22

3-
[program:selenium-grid-node-docker]
3+
; Priority 0 - socat 5 - selenium-docker
44

5+
[program:socat]
56
priority=0
6-
command=/opt/bin/start-selenium-grid-node-docker.sh
7+
command=/opt/bin/start-socat.sh
8+
autostart=true
9+
autorestart=false
10+
startsecs=0
11+
startretries=0
12+
13+
[program:selenium-grid-docker]
14+
priority=5
15+
command=/opt/bin/start-selenium-grid-docker.sh
716
autostart=true
817
autorestart=false
918
startsecs=0

NodeDocker/start-socat.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
# set -e: exit asap if a command exits with a non-zero status
4+
set -e
5+
6+
7+
if stat /var/run/docker.sock; then
8+
echo "Starting socat, docker.sock found."
9+
sudo socat TCP-L:2375,bind=127.0.0.1,fork,reuseaddr UNIX:/var/run/docker.sock
10+
else
11+
echo "docker.sock not found."
12+
fi

0 commit comments

Comments
 (0)