Skip to content
This repository was archived by the owner on Jun 30, 2024. It is now read-only.

Commit 720fc94

Browse files
committed
Clean: Fix docker group add code.
Remove on OS X for now until we know what to do.
1 parent 74c3f77 commit 720fc94

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

docker/docker_tools.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -285,18 +285,15 @@ def init(
285285
# Linux only: Ensure the user is in the ``docker`` group. This follows the `Docker docs <https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user>`__. Put this step here, instead of after the Docker install, for people who manually installed Docker but skipped this step.
286286
if is_linux:
287287
print("Checking to see if the current user is in the docker group...")
288-
if "www-data" not in xqt("groups", capture_output=True, text=True).stdout:
289-
if is_darwin:
290-
xqt("sudo dscl . append /Groups/docker GroupMembership $USER")
291-
292-
else:
293-
# Per the `Docker docs <https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user>`_, enable running Docker as a non-root user.
294-
#
295-
# Ignore errors if the groupadd fails; the group may already exist.
296-
xqt('sudo groupadd docker', check=False)
297-
xqt('sudo usermod -a -G docker $USER')
298-
# Until group privileges to take effect, use ``sudo`` to run Docker.
299-
docker_sudo = True
288+
if "docker" not in xqt("groups", capture_output=True, text=True).stdout:
289+
# Per the `Docker docs <https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user>`_, enable running Docker as a non-root user.
290+
#
291+
# Ignore errors if the groupadd fails; the group may already exist.
292+
xqt('sudo groupadd docker', check=False)
293+
xqt('sudo usermod -a -G docker $USER')
294+
295+
# Until group privileges to take effect, use ``sudo`` to run Docker.
296+
docker_sudo = True
300297
# The group add doesn't take effect until the user logs out then back in. Work around it for now.
301298
did_group_add = True
302299

0 commit comments

Comments
 (0)