-
-
Notifications
You must be signed in to change notification settings - Fork 442
Set fixed Docker GID to avoid collisions with some groups #523
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
Set fixed Docker GID to avoid collisions with some groups #523
Conversation
build/tools.sh
Outdated
| rm -rf /tmp/lfs.tar.gz "/tmp/git-lfs-${GIT_LFS_VERSION}" | ||
| } | ||
|
|
||
| function configure_docker_group_id() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go around here instead, no need to make it a function, just do groupadd -g "$(docker_group_id)" docker || :
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion! Moving it to here, unfortunately, doesn't work. The Docker packages automatically create the docker group with GID 999 during install_tools_apt. We need to create it with GID 500 beforehand to prevent this.
getent group docker
docker:x:999:runner
groupadd -g 500 docker || :
groupadd: group 'docker' already exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add it after
| apt-get update |
# The docker group needs to run before installers or similar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
myoung34
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last nit, if you'll modify
| group: |
group:
runner:
exists: true
gid: 121
docker:
exists: true
gid: 500
then the tests will verify that the group change works as expected
Stabilise Docker GID to Prevent Conflicts With Base System Services
This PR resolves an issue where the Docker group GID changes unpredictably between image builds. This instability causes failures in Docker-related operations, especially when using the image in containerised GitHub Actions workflows (runs_on: container).
Across recent GitHub Actions Runner image releases (e.g., 2.328.0 to 2.330.0), the GID assigned to the docker group has been inconsistent, landing somewhere in the 990–999 range.
Example
This GID drift breaks downstream images, the underlying cause is that several system services installed before Docker create groups that occupy the upper-range GIDs first. As a result, by the time the Docker package installs, the expected GID is already taken.
Common conflicting system groups include:
To prevent future collisions, the PR pre-creates the docker group before any Docker-related installation occurs, assigning it a fixed, safe GID.
Docker group GID is now fixed at 500.
Looking forward to hearing your feedback.