File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,18 @@ def get_docker_host() -> str:
3131 capture_output = True ,
3232 check = True ,
3333 )
34- contexts = (json .loads (line ) for line in result .stdout .splitlines ())
34+ docker_ls = result .stdout .splitlines ()
35+ # if this is empty, we are not in a dockerized environment; It's probably a podman environment on linux
36+ if not docker_ls or (len (docker_ls ) == 1 and docker_ls [0 ] == "[]" ):
37+ uid_result = subprocess .run (
38+ ["id" , "-u" ], # noqa: S607
39+ text = True ,
40+ capture_output = True ,
41+ check = True ,
42+ )
43+ uid = uid_result .stdout .strip ()
44+ return f"unix:///run/user/{ uid } /podman/podman.sock"
45+ contexts = (json .loads (line ) for line in docker_ls )
3546 return next (context ["DockerEndpoint" ] for context in contexts if context ["Current" ] is True )
3647
3748
You can’t perform that action at this time.
0 commit comments