Docker: added container vpn network support

This commit is contained in:
bergware
2020-02-09 23:51:35 +01:00
parent 68bcee42be
commit 3f51e6bb36
5 changed files with 63 additions and 40 deletions

View File

@@ -845,7 +845,7 @@ class DockerClient {
$c['CPUset'] = $info['HostConfig']['CpusetCpus'];
$c['BaseImage'] = $ct['Labels']['BASEIMAGE'] ?? false;
$c['Ports'] = [];
if ($id) $c['NetworkMode'] = $net.str_replace('/',':',DockerUtil::docker("inspect --format='{{.Name}}' $id")?:'/???');
if ($id) $c['NetworkMode'] = $net.str_replace('/',':',DockerUtil::ctMap($id)?:'/???');
if ($driver[$c['NetworkMode']]=='bridge') {
$ports = &$info['HostConfig']['PortBindings'];
$nat = true;
@@ -969,5 +969,8 @@ class DockerUtil {
exec('cat /sys/devices/system/cpu/*/topology/thread_siblings_list|sort -nu', $cpus);
return $cpus;
}
public static function ctMap($ct, $type='Name') {
return static::docker("inspect --format='{{.$type}}' $ct");
}
}
?>