Skip to content
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

fix(action): Proxy rootful/rootless Docker sockets #83

Merged
merged 3 commits into from
Jul 16, 2022
Merged

Conversation

Kurt-von-Laven
Copy link
Contributor

@Kurt-von-Laven Kurt-von-Laven commented Jul 14, 2022

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.

Don't set environment variables early. The rootless Docker install script recommends setting some environment variables after it's run. Setting XDG_RUNTIME_DIR in particular before the script has run prevents it from automatically creating ~/.docker/run when XDG_RUNTIME_DIR is unset. Hence, wait until the script has run to set these environment variables. While the commands to set these environment variables still take place before the install script is run, they will not be sourced by the GitHub Actions runner until the subsequent workflow step runs.

Make a workflow step name more descriptive. Clarify that the step stops the rootful, not rootless, Docker daemon.

@Kurt-von-Laven Kurt-von-Laven self-assigned this Jul 14, 2022
@Kurt-von-Laven Kurt-von-Laven changed the title fix(action): Install rootless Docker via packages fix(action): Proxy rootful/rootless Docker sockets Jul 16, 2022
Clarify that the step stops the rootful, not rootless, Docker daemon.
The rootless Docker install script recommends setting some environment
variables after it's run. Setting XDG_RUNTIME_DIR in particular before
the script has run prevents it from automatically creating ~/.docker/run
when XDG_RUNTIME_DIR is unset. Hence, wait until the script has run to
set these environment variables. While the commands to set these
environment variables still take place before the install script is run,
they will not be sourced by the GitHub Actions runner until the
subsequent workflow step runs.
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.
Copy link
Contributor

@mwarres mwarres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Nice solution!

@Kurt-von-Laven Kurt-von-Laven merged commit 5dc4dd8 into main Jul 16, 2022
@Kurt-von-Laven Kurt-von-Laven deleted the action branch July 16, 2022 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants