copyToContainer function

Future<void> copyToContainer(
  1. String name,
  2. String localPath,
  3. String remotePath
)

Implementation

Future<void> copyToContainer(
  String name,
  String localPath,
  String remotePath,
) async {
  final result = await Process.run('docker', [
    'cp',
    localPath,
    '$name:$remotePath',
  ]);
  if (result.exitCode != 0) {
    throw Exception(
      'Failed to copy $localPath to $name:$remotePath: ${result.stderr}',
    );
  }
}