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

Commit f86457b

Browse files
committed
Fix: Run hello-world in Docker as a diagnostic for all OSes.
1 parent b12163b commit f86457b

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

docker/docker_tools.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -217,17 +217,6 @@ def init(
217217
# Ensure Docker is installed.
218218
try:
219219
xqt("docker --version")
220-
# Ensure the Docker Desktop is running if this is OS X. On OS X, the ``docker`` command exists, but can't run the hello, world script.
221-
if is_darwin:
222-
print("Checking that the Docker Desktop is running...")
223-
try:
224-
xqt("docker run hello-world")
225-
except subprocess.CalledProcessError as e:
226-
print(f"Unable to execute docker run hello-world: {e}")
227-
sys.exit(
228-
"ERROR: Docker Desktop not detected. You must install and run this\n"
229-
"before proceeding."
230-
)
231220
except subprocess.CalledProcessError as e:
232221
print(f"Unable to run docker: {e}")
233222
# Ensure the Docker Desktop is running if we're running in WSL. On Windows, the ``docker`` command doesn't exist when the Docker Desktop isn't running.
@@ -252,11 +241,26 @@ def init(
252241
if is_darwin:
253242
xqt("sudo dscl . append /Groups/docker GroupMembership $USER")
254243
else:
255-
xqt("sudo usermod -aG docker ${USER}")
244+
xqt("sudo usermod -a -G docker ${USER}")
256245

257246
# The group add doesn't take effect until the user logs out then back in. Work around it for now.
258247
did_group_add = True
259248

249+
# Ensure the Docker Desktop is running if this is OS X. On OS X, the ``docker`` command exists, but can't run the hello, world script. It also serves as a sanity check for the other platforms.
250+
print("Checking that Docker works...")
251+
try:
252+
xqt("docker run hello-world")
253+
except subprocess.CalledProcessError as e:
254+
print(f"Unable to execute docker run hello-world: {e}")
255+
sys.exit(
256+
(
257+
"ERROR: Docker Desktop not detected. You must install and run this\n"
258+
"before proceeding."
259+
)
260+
if is_darwin
261+
else "ERROR: Unable to run a basic Docker application."
262+
)
263+
260264
# Make sure git's installed.
261265
try:
262266
xqt("git --version")

0 commit comments

Comments
 (0)