run method

Future<String> run({
  1. required String image,
  2. String? command,
  3. Map<String, String> env = const {},
  4. String? mountPath,
  5. String? mountSubpath,
  6. String? role,
  7. String? participantName,
  8. Map<int, int> ports = const {},
  9. List<DockerSecret> credentials = const [],
  10. String? name,
  11. ContainerMountSpec? mounts,
  12. bool? writableRootFs,
  13. 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);
  }
}