run method
Future<String>
run({
- required String image,
- String? command,
- Map<
String, String> env = const {}, - String? mountPath,
- String? mountSubpath,
- String? role,
- String? participantName,
- Map<
int, int> ports = const {}, - List<
DockerSecret> credentials = const [], - String? name,
- ContainerMountSpec? mounts,
- bool? writableRootFs,
- bool? private,
Implementation
Future<String> run({
required String image,
String? command,
Map<String, String> env = const {},
String? mountPath,
String? mountSubpath,
String? role,
String? participantName,
Map<int, int> ports = const {},
List<DockerSecret> credentials = const [],
String? name,
ContainerMountSpec? mounts,
bool? writableRootFs,
bool? private,
}) async {
final requestId = Uuid().v4().toString();
final controller = StreamController<String>();
final progress = StreamController<LogProgress>();
_loggers[requestId] = controller;
_progress[requestId] = progress;
try {
final req = _RunRequest(
name: name,
requestId: requestId,
image: image,
command: command,
env: env,
mountPath: mountPath,
mountSubpath: mountSubpath,
role: role,
participantName: participantName,
ports: ports,
credentials: credentials,
mounts: mounts,
writableRootFs: writableRootFs,
private: private,
);
final res = await room.sendRequest("containers.run", req.toJson());
return (res as JsonResponse).json["container_id"];
} finally {
_loggers.remove(requestId);
_progress.remove(requestId);
}
}