File tree 1 file changed +4
-7
lines changed
1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -140,11 +140,8 @@ def get_docker_host():
140
140
Returns:
141
141
docker_host (str): Docker host DNS or IP
142
142
"""
143
- try :
144
- docker_context_string = os .popen ("docker context inspect" ).read ()
145
- docker_context_host_url = json .loads (docker_context_string )[0 ]['Endpoints' ]['docker' ]['Host' ]
146
- parsed_url = urlparse (docker_context_host_url )
147
- docker_host = parsed_url .hostname if parsed_url .hostname and parsed_url .scheme == "tcp" else "localhost"
148
- except Exception :
149
- docker_host = "localhost"
143
+ docker_context_string = os .popen ("docker context inspect" ).read ()
144
+ docker_context_host_url = json .loads (docker_context_string )[0 ]['Endpoints' ]['docker' ]['Host' ]
145
+ parsed_url = urlparse (docker_context_host_url )
146
+ docker_host = parsed_url .hostname if parsed_url .hostname and parsed_url .scheme == "tcp" else "localhost"
150
147
return docker_host
You can’t perform that action at this time.
0 commit comments