Skip to content

Commit

Permalink
Workaround to mount docker.sock (#1505) [deploy]
Browse files Browse the repository at this point in the history
* Workaround to mount docker.sock

* Updating docs to mount docker.sock
  • Loading branch information
diemol committed Feb 8, 2022
1 parent 281e5c4 commit 459ebc2
Show file tree
Hide file tree
Showing 12 changed files with 221 additions and 94 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ docker: base generate_docker
generate_standalone_docker:
cd ./StandaloneDocker && ./generate.sh $(TAG_VERSION) $(NAMESPACE) $(AUTHORS)

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

generate_standalone_firefox:
Expand Down
14 changes: 12 additions & 2 deletions NodeDocker/Dockerfile.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
USER root

#==============
# Socat to proxy docker.sock when mounted
#==============
RUN apt-get update -qqy \
&& apt-get -qqy install socat \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*

USER 1200

#========================
Expand All @@ -6,9 +15,10 @@ USER 1200

EXPOSE 4444

COPY start-selenium-grid-node-docker.sh \
COPY start-selenium-grid-docker.sh \
config.toml \
start-socat.sh \
/opt/bin/

COPY selenium-grid-node-docker.conf /etc/supervisor/conf.d/
COPY selenium-grid-docker.conf /etc/supervisor/conf.d/

2 changes: 1 addition & 1 deletion NodeDocker/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ configs = [
# Linux could use --net=host in the `docker run` instruction or 172.17.0.1 in the URI below.
# To have Docker listening through tcp on macOS, install socat and run the following command
# socat -4 TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock
url = "http://host.docker.internal:2375"
url = "http://127.0.0.1:2375"
# Docker image used for video recording
video-image = "selenium/video:ffmpeg-4.3.1-20220131"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
; Documentation of this file format -> http://supervisord.org/configuration.html

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

[program:socat]
priority=0
command=/opt/bin/start-selenium-grid-node-docker.sh
command=/opt/bin/start-socat.sh
autostart=true
autorestart=false
startsecs=0
startretries=0

[program:selenium-grid-docker]
priority=5
command=/opt/bin/start-selenium-grid-docker.sh
autostart=true
autorestart=false
startsecs=0
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions NodeDocker/start-socat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# set -e: exit asap if a command exits with a non-zero status
set -e


if stat /var/run/docker.sock; then
echo "Starting socat, docker.sock found."
sudo socat TCP-L:2375,bind=127.0.0.1,fork,reuseaddr UNIX:/var/run/docker.sock
else
echo "docker.sock not found."
fi

0 comments on commit 459ebc2

Please sign in to comment.