Skip to content

Commit

Permalink
fix(action): Proxy rootful/rootless Docker sockets
Browse files Browse the repository at this point in the history
The GitHub Actions runner hard-codes the Docker socket to
unix:///var/run/docker.sock. It is no longer possible to reliably run
the rootful and rootless Docker daemons concurrently now that they each
check that they are the only daemon running. Hence, proxy
bidirectionally between the rootful and rootless
(unix://$XDG_RUNTIME_DIR/docker.sock) Docker sockets rather than attempt
to start the rootful Docker daemon back up. Don't close the rootful
Docker socket so that it can be proxied.
  • Loading branch information
Kurt-von-Laven committed Jul 16, 2022
1 parent 9d32d89 commit 5dc4dd8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions .dictionary.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Laven
proxyd
15 changes: 13 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ runs:
shell: bash
- name: Stop rootful Docker daemon.
if: steps.rootless-docker.outputs.in-use != 'true'
run: sudo systemctl stop docker.service docker.socket
run: sudo systemctl stop docker.service
shell: bash
- name: Install rootless Docker, start daemon, and wait until it's listening.
if: steps.rootless-docker.outputs.installed != 'true'
Expand Down Expand Up @@ -58,7 +58,18 @@ runs:
(PATH="/sbin:/usr/sbin:$PATH" dockerd-rootless.sh &) |&
awaitDockerd
fi
sudo systemctl start docker.service docker.socket
env:
FORCE_ROOTLESS_INSTALL: "1"
shell: bash
- name: Proxy bidirectionally between rootful and rootless Docker sockets.
if: steps.rootless-docker.outputs.in-use != 'true'
run: >
sudo systemd-run
--unit=docker-proxy.service
--description="Bidirectional proxy between rootful and rootless Docker sockets"
--service-type=exec
--property=Requires=docker.socket
--property=PrivateNetwork=true
--property=PrivateTmp=true
/lib/systemd/systemd-socket-proxyd "$XDG_RUNTIME_DIR/docker.sock"
shell: bash

0 comments on commit 5dc4dd8

Please sign in to comment.