mirror of
https://github.com/clearml/clearml-agent
synced 2025-04-29 10:18:50 +00:00
Fix k8s support to allow a specific network for the docker (do not use the parent daemon network definition)
This commit is contained in:
parent
e3d0680d39
commit
f2d2d702de
@ -1898,13 +1898,14 @@ class Worker(ServiceCommandSection):
|
||||
|
||||
# check if running inside a kubernetes
|
||||
if os.environ.get('KUBERNETES_SERVICE_HOST') and os.environ.get('KUBERNETES_PORT'):
|
||||
# map network to sibling docker
|
||||
try:
|
||||
network_mode = get_bash_output(
|
||||
'docker inspect --format=\'{{.HostConfig.NetworkMode}}\' $(basename $(cat /proc/1/cpuset))')
|
||||
base_cmd += ['--network', network_mode]
|
||||
except:
|
||||
pass
|
||||
# map network to sibling docker, unless we have other network argument
|
||||
if not any(a.strip().startswith('--network') for a in base_cmd):
|
||||
try:
|
||||
network_mode = get_bash_output(
|
||||
'docker inspect --format=\'{{.HostConfig.NetworkMode}}\' $(basename $(cat /proc/1/cpuset))')
|
||||
base_cmd += ['--network', network_mode]
|
||||
except:
|
||||
pass
|
||||
base_cmd += ['-e', 'NVIDIA_VISIBLE_DEVICES={}'.format(dockers_nvidia_visible_devices)]
|
||||
|
||||
# check if we need to map host folders
|
||||
|
Loading…
Reference in New Issue
Block a user