Menu="OtherSettings" Title="Docker" Icon="icon-docker" Tag="icon-docker" --- /dev/null",$dummy,$DockerStopped); function strposX($s, $c, $n=1) { $p = 0; while ($n && $p = strpos($s,$c,$p) !== false) {$n--; $p += strlen($c);} return $p; } unset($custom,$other); exec("ls --indicator-style=none /sys/class/net | grep -P '^br[0-9]'",$custom); exec("ls --indicator-style=none /sys/class/net | grep -P '^(bond|eth|wlan)[0-9]'",$other); $bridge = count($custom) > 0; $slaves = []; foreach ($other as $network) { if (substr($network,0,4) == 'bond') { $br = str_replace('bond','br',$network); $bond = "/sys/class/net/$network/bonding/slaves"; if (file_exists($bond)) $slaves = array_merge($slaves,explode(' ',str_replace("\n","",file_get_contents($bond)))); if (!in_array($br,$custom)) $custom[] = $network; } elseif ($bridge && substr($network,0,3) == 'eth') { $br = str_replace('eth','br',$network); $bond = str_replace('eth','bond',$network); if (!in_array($br,$custom) && !in_array($bond,$custom)) $custom[] = $network; } else { $custom[] = $network; } } $include = $include6 = $address = $address6 = $gateway = $gateway6 = $unset = $protocol = []; $wide = false; $wlan = (array)@parse_ini_file('/var/local/emhttp/wireless.ini'); foreach ($custom as $network) { if (in_array($network,$slaves)) continue; $ip4 = exec("ip -4 -br addr show scope global primary dev $network | awk '{print $3;exit}'"); $ip6 = exec("ip -6 -br addr show scope global primary -deprecated dev $network | awk '{print $3;exit}'"); $gw4 = $ip4 ? exec("ip -4 route show to default dev $network | awk '{print $3;exit}'") : ''; $gw6 = $ip6 ? exec("ip -6 route show to default dev $network | awk '{print $3;exit}'") : ''; $route4 = $ip4 ? exec("ip -4 route show dev $network | sort | awk -v ORS=\" \" '\$1 !~ /^default/ {print \$1}' | sed 's/ \$//'") : ''; $route6 = $ip6 ? exec("ip -6 route show dev $network | sort | awk -v ORS=\" \" '\$1 !~ /^(default|fe80)/ {print \$1}' | sed 's/ \$//'") : ''; if (substr($network,0,4) != 'wlan') { [$eth,$vlan] = my_explode('.',$network); $eth = str_replace(['bond','br'],'eth',$eth); if (!$vlan) { $protocol[$network] = _var($$eth,'PROTOCOL:0','ipv4'); } else { foreach ($$eth as $key => $value) if (strpos($key,'VLANID')!==false && $value==$vlan) {$protocol[$network] = _var($$eth,str_replace('VLANID','PROTOCOL',$key),'ipv4'); break;} } } else { $protocol[$network] = empty($wlan['IP6']) ? 'ipv4' : 'ipv4+ipv6'; } if ($ip4 && $route4) { $include[$network] = $route4; $address[$network] = $ip4; $gateway[$network] = $gw4; } elseif (!array_key_exists($network,$gateway6)) { $unset[] = $network; } if ($ip6 && $route6) { $include6[$network] = $route6; $address6[$network] = $ip6; $gateway6[$network] = $gw6; } elseif (!array_key_exists($network,$gateway)) { $unset[] = $network; } if ($protocol[$network] != 'ipv4') $wide = true; } $ip4class = $wide ? 'ip6' : 'ip4'; $gw4class = $wide ? 'gw6' : 'gw4'; $unset = array_unique($unset); function normalize($network) { return strtoupper(str_replace('.','_',$network)); } function base_min($route) { [$net,$mask] = my_explode('/',$route); $mask = 32-$mask; return explode('.',long2ip((ip2long($net)>>$mask)<<$mask)); } function base_max($route) { [$net,$mask] = my_explode('/',$route); $mask = 32-$mask; return explode('.',long2ip(((ip2long($net)>>$mask)<<$mask)+pow(2,$mask)-1)); } function base_net($route) { return substr(explode('/',$route)[0],0,-2); } $bgcolor = $themeHelper->isLightTheme() ? '#f2f2f2' : '#1c1c1c'; // $themeHelper set in DefaultPageLayout.php //Check if docker.cfg does exist $no_dockercfg = !is_file('/boot/config/docker.cfg'); ?>   :
_(Enable Docker)_: : :docker_enable_help: _(Enable container table readmore-js)_: : :docker_readmore_help: _(Docker Stop Timeout)_ (_(seconds)_): : :docker_timeout_help: _(Docker PID Limit)_: : :docker_pid_limit_help: _(Docker data-root)_: : :docker_vdisk_type_help: _(Default appdata storage location)_: : _(Modify with caution: unable to validate path until Array is Started)_ :docker_appdata_location_help:
_(Docker LOG rotation)_: : :docker_log_rotation_help: _(Template Authoring Mode)_: : :docker_authoring_mode_help: _(Docker custom network type)_: : _(Please read the Help carefully)_. _(Misconfiguration can cause problems)_. :docker_custom_network_type_help: _(Host access to custom networks)_: : _(Make sure you understand what you are doing before enabling)_. :docker_custom_network_access_help: _(Preserve user defined networks)_: : :docker_user_defined_network_help: $route):?> _(IPv4 custom network on interface)_ (_(optional)_): "{$docker_dhcp}_{$b}", 'options' => [] ]; for ($n = $net[$b]; $n <= $max[$b]; $n++) { $network_selects[$b]['options'][] = mk_option($net_user[$b], $n, $n, $n % $step == 0 ? '' : 'class="hide"'); } } // Build mask select options $mask_options = []; for ($m = $mask + 1; $m <= 30; $m++) { $mask_options[] = mk_option($mask_user, $m, $m); } ?> :
: '._('Subnet').': ', $route)?> : . ( )
:docker_include_interface_vlan_ipv4_help: _(IPv4 custom network on interface)_ (_(optional)_): :
: > : " title="_(IPv4 address A.B.C.D)_"> > ( _(hosts)_)
:docker_exclude_interface_vlan_ipv4_help: $route):?> _(IPv6 custom network on interface)_ (_(optional)_): : **_(Subnet)_:** '._('Subnet').': ', $route)?> **_(Gateway)_:** :docker_include_interface_vlan_ipv6_help: _(IPv6 custom network on interface)_ (_(optional)_): :
: > : " title="_(IPv6 address nnnn:xxxx::yyyy)_">
:docker_exclude_interface_vlan_ipv6_help:
_(Docker version)_: : getInfo(); echo $arrInfo['Version']?> :docker_version_help: _(Docker vDisk location)_: : _(Docker directory)_: : :docker_vdisk_location_active_help: _(Docker storage driver)_: : :docker_storage_driver_active_help: _(Default appdata storage location)_: : :docker_appdata_location_active_help:
_(Docker LOG rotation)_: : :docker_log_rotation_active_help: _(Docker custom network type)_: : :docker_custom_network_type_help: _(Host access to custom networks)_: : :docker_custom_network_access_help: _(Preserve user defined networks)_: : :docker_user_defined_network_help: $route):?> _(IPv4 custom network on interface)_ : : **_(Subnet)_:** '._('Subnet').': ', $route)?> **_(Gateway)_:** **_(DHCP pool)_:**   ( _(hosts)_) $value) { if (strpos($key,'VLANID')!==false && $value==$vlan) {$protocol = _var($$eth,str_replace('VLANID','PROTOCOL',$key),'ipv4'); break;} } } } else { $protocol = empty($wlan['IP6']) ? 'ipv4' : 'ipv4+ipv6'; } [$subnet, $mask] = my_explode('/',_var($dockercfg,"DOCKER_SUBNET_$port")); [$range, $size] = my_explode('/',_var($dockercfg,"DOCKER_RANGE_$port")); ?> _(IPv4 custom network on interface)_ : : **_(Subnet)_:** / **_(Gateway)_:** **_(DHCP pool)_:**   ( _(hosts)_) $route):?> _(IPv6 custom network on interface)_ : : **_(Subnet)_:** '._('Subnet').': ', $route)?> **_(Gateway)_:** $value) { if (strpos($key,'VLANID')!==false && $value==$vlan) {$protocol = _var($$eth,str_replace('VLANID','PROTOCOL',$key),'ipv4'); break;} } } } else { $protocol = empty($wlan['IP6']) ? 'ipv4' : 'ipv4+ipv6'; } [$subnet6, $mask6] = my_explode('/',_var($dockercfg,"DOCKER_SUBNET6_$port")); [$range6, $size6] = my_explode('/',_var($dockercfg,"DOCKER_RANGE6_$port")); ?> _(IPv6 custom network on interface)_ : : **_(Subnet)_:** / **_(Gateway)_:**
  :
_(Docker volume info)_
_(btrfs filesystem show)_: : ".shell_exec("btrfs filesystem show /var/lib/docker").""?>
_(btrfs scrub status)_: : ".implode("\n", $scrub_status).""?>   : :docker_scrub_help:   : :docker_cancel_help: