MCPcopy Index your code
hub / github.com/docker/docker-py / get_current_context_name

Function get_current_context_name

docker/context/config.py:12–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10
11
12def get_current_context_name():
13 name = "default"
14 docker_cfg_path = find_config_file()
15 if docker_cfg_path:
16 try:
17 with open(docker_cfg_path) as f:
18 name = json.load(f).get("currentContext", "default")
19 except Exception:
20 return "default"
21 return name
22
23
24def write_context_name_to_docker_config(name=None):

Callers 2

get_contextMethod · 0.85
remove_contextMethod · 0.85

Calls 3

find_config_fileFunction · 0.90
loadMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected