buildContainerArgs method
ContainerInfosLocal
buildContainerArgs(
- String cmd,
- String imageName,
- String? version,
- String containerName,
- List<
String> ? ports, - String? network,
- String? hostname,
- Map<
String, String> ? environment, - Map<
String, String> ? volumes, - bool cleanContainer,
- String? healthCmd,
- Duration? healthInterval,
- int? healthRetries,
- Duration? healthStartPeriod,
- Duration? healthTimeout,
- String? restart, {
- bool addCIDFile = false,
override
Implementation
@override
ContainerInfosLocal buildContainerArgs(
String cmd,
String imageName,
String? version,
String containerName,
List<String>? ports,
String? network,
String? hostname,
Map<String, String>? environment,
Map<String, String>? volumes,
bool cleanContainer,
String? healthCmd,
Duration? healthInterval,
int? healthRetries,
Duration? healthStartPeriod,
Duration? healthTimeout,
String? restart, {
bool addCIDFile = false,
}) {
var containerInfos = super.buildContainerArgs(
cmd,
imageName,
version,
containerName,
ports,
network,
hostname,
environment,
volumes,
cleanContainer,
healthCmd,
healthInterval,
healthRetries,
healthStartPeriod,
healthTimeout,
restart,
);
var args = containerInfos.args!;
// Last parameter is the image.
// Remove to append more parameters, then add it in the end:
args.removeLast();
if (containerInfos.containerNetwork != null) {
var networkHostsIPs =
getNetworkRunnersHostnamesAndIPs(containerInfos.containerNetwork);
for (var networkContainerName in networkHostsIPs.keys) {
if (networkContainerName == containerName) continue;
var hostMaps = networkHostsIPs[networkContainerName]!;
for (var host in hostMaps.keys) {
var ip = hostMaps[host];
args.add('--add-host');
args.add('$host:$ip');
}
}
}
File? idFile;
if (addCIDFile) {
idFile = _createTemporaryFile('cidfile');
args.add('--cidfile');
args.add(idFile.path);
}
args.add(containerInfos.image!);
return ContainerInfosLocal(
containerInfos.containerName,
containerInfos.image,
idFile,
containerInfos.ports,
containerInfos.containerNetwork,
containerInfos.containerHostname,
containerInfos.args,
);
}