🎈 Sync 2026-05-22 14:28:32

This commit is contained in:
github-actions[bot] committed 2026-05-22 14:28:32 +08:00
1 parent 7f7b99cc2f
commit 5635d6c1ec
70 files changed
+7296 -4358

No files matched your search

@@ -84,6 +84,10 @@ return dm2.dv.extend({
privileged: hostConfig.Privileged ? 1 : 0,
restart_policy: hostConfig.RestartPolicy?.Name || 'unless-stopped',
network: firstName || '',
network_aliases: (() => {
if (!firstName || builtInNetworks.has(firstName)) return '';
return (firstNet?.Aliases || []).join(', ');
})(),
ipv4: (() => {
if (!firstName || builtInNetworks.has(firstName)) return '';
return firstNet?.IPAddress || '';
@@ -137,14 +141,19 @@ return dm2.dv.extend({
if (Array.isArray(bindings) && bindings.length > 0) {
for (const b of bindings) {
if (!b?.HostPort) continue;
const ip = b.HostIp || '';
const ip = (b.HostIp && b.HostIp !== '0.0.0.0' && b.HostIp !== '::') ? b.HostIp : '';
ports.push((ip ? ip + ':' : '') + b.HostPort + ':' + containerPort);
}
}
}
return ports;
})(),
command: c.Config?.Cmd ? c.Config?.Cmd.join(' ') : '',
command: c.Config?.Cmd ? c.Config?.Cmd.map(arg => {
if (arg.includes(' ') || arg.includes('"') || arg.includes("'")) {
return '"' + arg.replace(/"/g, '\\"') + '"';
}
return arg;
}).join(' ') : '',
hostname: c.Config?.Hostname || '',
publish_all: hostConfig.PublishAllPorts ? 1 : 0,
device: (hostConfig.Devices || []).map(d => d.PathOnHost + ':' + d.PathInContainer + (d.CgroupPermissions ? ':' + d.CgroupPermissions : '')),
@@ -184,6 +193,7 @@ return dm2.dv.extend({
}
return list;
})(),
log_driver: hostConfig.LogConfig?.Type || '',
};
}
@@ -269,6 +279,11 @@ return dm2.dv.extend({
o.datatype = 'ip6ll';
o.validate = not_with_a_docker_net;
o = s.option(form.Value, 'network_aliases', _('Network Aliases'));
o.rmempty = true;
o.placeholder = 'database,db (CSV)';
o.validate = not_with_a_docker_net;
o = s.option(form.DynamicList, 'link', _('Links with other containers'));
o.rmempty = true;
o.placeholder='container_name:alias';
@@ -733,6 +748,14 @@ return dm2.dv.extend({
o.placeholder='max-size=1m';
o.depends('advanced', 1);
o = s.option(form.ListValue, 'log_driver', _('Log driver'));
o.rmempty = true;
o.value('', _('Default (daemon)'));
o.value('local', _('local'));
o.value('json-file', _('json-file'));
o.value('syslog', _('syslog'));
o.value('none', _('none'));
o.depends('advanced', 1);
this.map = m;
@@ -757,8 +780,10 @@ return dm2.dv.extend({
.then(() => {
const get = (opt) => map.data.get('json', 'container', opt);
const name = get('name');
const log_driver = get('log_driver');
// const pull = toBool(get('pull'));
const network = get('network');
const network_aliases = get('network_aliases');
const publish = get('publish');
const command = get('command');
// const publish_all = toBool(get('publish_all'));
@@ -774,7 +799,7 @@ return dm2.dv.extend({
Tty: toBool(get('tty')),
OpenStdin: toBool(get('interactive')),
Env: get('env'),
Cmd: command ? command.split(' ') : null,
Cmd: command ? (command.match(/(?:[^\s"]+|"[^"]*")+/g) || []).map(arg => arg.replace(/^"|"$/g, '')) : null,
Image: get('image'),
HostConfig: {
CpuShares: toInt(get('cpu_shares')),
@@ -795,24 +820,45 @@ return dm2.dv.extend({
CgroupPermissions: parts[2] || 'rwm'
};
}) : undefined,
LogConfig: log_opt ? {
LogConfig: log_driver ? {
Type: log_driver,
Config: listToKv(log_opt)
} : (log_opt ? {
Type: 'json-file',
Config: listToKv(log_opt)
} : undefined,
} : undefined),
NetworkMode: network,
PortBindings: publish ? Object.fromEntries(
(Array.isArray(publish) ? publish : [publish])
.filter(p => p && typeof p === 'string' && p.trim().length > 0)
.map(p => {
// formats: hostPort:cPort/proto or hostIp:hostPort:cPort/proto
const m = p.match(/^(?:([^:]+):(\d+)|(\d+)):(\d+)\/(tcp|udp)$/);
if (!m) return null;
const hostIp = m[1] || '';
const hostPort = m[2] || m[3];
const cPort = m[4];
const proto = m[5];
const binding = hostIp ? { HostIp: hostIp, HostPort: hostPort } : { HostPort: hostPort };
return [`${cPort}/${proto}`, [binding]];
// hostIp:hostPort:cPort/proto (e.g. 192.168.1.100:8080:80/tcp)
const m = p.match(/^([^:]+):(\d+):(\d+)\/(tcp|udp)$/);
if (m) {
const hostIp = m[1];
const hostPort = m[2];
const cPort = m[3];
const proto = m[4];
return [`${cPort}/${proto}`, [{ HostIp: hostIp, HostPort: hostPort }]];
}
// [ipv6]:hostPort:cPort/proto (e.g. [::1]:8080:80/tcp)
const m6 = p.match(/^\[([^\]]+)\]:(\d+):(\d+)\/(tcp|udp)$/);
if (m6) {
const hostIp = m6[1];
const hostPort = m6[2];
const cPort = m6[3];
const proto = m6[4];
return [`${cPort}/${proto}`, [{ HostIp: hostIp, HostPort: hostPort }]];
}
// hostPort:cPort/proto (e.g. 8080:80/tcp)
const m2 = p.match(/^(\d+):(\d+)\/(tcp|udp)$/);
if (m2) {
const hostPort = m2[1];
const cPort = m2[2];
const proto = m2[3];
return [`${cPort}/${proto}`, [{ HostPort: hostPort }]];
}
return null;
}).filter(Boolean)
) : undefined,
Mounts: undefined,
@@ -832,7 +878,10 @@ return dm2.dv.extend({
Sysctls: sysctl ? listToKv(sysctl) : undefined,
},
NetworkingConfig: {
EndpointsConfig: { [network]: { IPAMConfig: { IPv4Address: get('ipv4') || null, IPv6Address: get('ipv6') || null } } },
EndpointsConfig: { [network]: {
IPAMConfig: { IPv4Address: get('ipv4') || null, IPv6Address: get('ipv6') || null },
Aliases: network_aliases ? network_aliases.split(',').map(a => a.trim()).filter(Boolean) : null
} },
}
};