Skip to content

Workaround to mount docker.sock #1505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading