createContainer method

Future<ContainerInfos?> createContainer(
  1. String containerName,
  2. String imageName, {
  3. String? version,
  4. List<String>? ports,
  5. String? network,
  6. String? hostname,
  7. Map<String, String>? environment,
  8. Map<String, String>? volumes,
  9. bool cleanContainer = false,
  10. String? healthCmd,
  11. Duration? healthInterval,
  12. int? healthRetries,
  13. Duration? healthStartPeriod,
  14. Duration? healthTimeout,
  15. String? restart,
})

Creates a Docker container with containerName, image and optional version.

Implementation

Future<ContainerInfos?> createContainer(
  String containerName,
  String imageName, {
  String? version,
  List<String>? ports,
  String? network,
  String? hostname,
  Map<String, String>? environment,
  Map<String, String>? volumes,
  bool cleanContainer = false,
  String? healthCmd,
  Duration? healthInterval,
  int? healthRetries,
  Duration? healthStartPeriod,
  Duration? healthTimeout,
  String? restart,
}) async {
  await ensureInitialized();
  return dockerHost.createContainer(
    containerName,
    imageName,
    version: version,
    ports: ports,
    network: network,
    hostname: hostname,
    environment: environment,
    volumes: volumes,
    cleanContainer: cleanContainer,
    healthCmd: healthCmd,
    healthInterval: healthInterval,
    healthRetries: healthRetries,
    healthStartPeriod: healthStartPeriod,
    healthTimeout: healthTimeout,
    restart: restart,
  );
}