[docker-setup]: Fix docker group membership check#2070
Merged
theasianpianist merged 3 commits intosonic-net:masterfrom Aug 10, 2020
Merged
[docker-setup]: Fix docker group membership check#2070theasianpianist merged 3 commits intosonic-net:masterfrom
theasianpianist merged 3 commits intosonic-net:masterfrom
Conversation
Signed-off-by: Lawrence Lee <[email protected]>
* Use result of `docker ps` to check for correct docker permissions instead of grepping the output of `id -Gn` since it is possible for the user to have docker permissions without the docker group showing up in `id -Gn` Signed-off-by: Lawrence Lee <[email protected]>
lguohan
reviewed
Aug 7, 2020
Signed-off-by: Lawrence Lee <[email protected]>
lguohan
approved these changes
Aug 8, 2020
yxieca
approved these changes
Aug 9, 2020
kazinator-arista
pushed a commit
to kazinator-arista/sonic-mgmt
that referenced
this pull request
Mar 4, 2026
swss 081d47b Update netlink messages handler (sonic-net#2233) de7c3eb [IntfMgrd] Retry adding ipv6 prefix by setting disabled_ipv6 flag (sonic-net#2267) utilities 2716ff2 [yang] extend ConfigMgmt constructor to pass YANG options (sonic-net#2118) 9fbe2ef [debug dump] dump interface module added (sonic-net#2070) a86da2d Add sonic-delayed.target to Application Extension .timer file generator (sonic-net#2176) 90611dd [portconfig] Allow to configure interface mtu for physical ports only
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Lawrence Lee [email protected]
Description of PR
Summary:
Fix the check that the user is a member of the docker group. Also moves the membership check to before any docker commands are run.
Type of change
Approach
What is the motivation for this PR?
Prevent docker commands from running without first validating that user is a member of the docker group. It is possible for a user to have docker permissions without explicitly being in the docker group (show by
id -Gn <user>orgroups <user>). The previous approach grepped the output ofid -Gnfor the docker group, which is not always reliable.How did you do it?
Instead of searching the output of
id -Gn, check if user is able to rundocker infosuccessfully. Successful execution indicates the user has docker privileges, failure means the use does not have docker privileges.How did you verify/test it?
Remove user from docker group and run script - ensure that script exits early with correct error message about group membership.
Re-add user to docker group and run script - ensure that script completes successfully.
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation