createService method

Future<Service?> createService(
  1. String serviceName,
  2. String imageName, {
  3. String? version,
  4. int? replicas,
  5. List<String>? ports,
  6. String? network,
  7. String? hostname,
  8. Map<String, String>? environment,
  9. Map<String, String>? volumes,
  10. String? healthCmd,
  11. Duration? healthInterval,
  12. int? healthRetries,
  13. Duration? healthStartPeriod,
  14. Duration? healthTimeout,
})

Creates a Docker service with serviceName, image and optional version. Note that the Docker Daemon should be in Swarm mode.

Implementation

Future<Service?> createService(
  String serviceName,
  String imageName, {
  String? version,
  int? replicas,
  List<String>? ports,
  String? network,
  String? hostname,
  Map<String, String>? environment,
  Map<String, String>? volumes,
  String? healthCmd,
  Duration? healthInterval,
  int? healthRetries,
  Duration? healthStartPeriod,
  Duration? healthTimeout,
}) async {
  await ensureInitialized();
  return dockerHost.createService(
    serviceName,
    imageName,
    version: version,
    replicas: replicas,
    ports: ports,
    network: network,
    hostname: hostname,
    environment: environment,
    volumes: volumes,
    healthCmd: healthCmd,
    healthInterval: healthInterval,
    healthRetries: healthRetries,
    healthStartPeriod: healthStartPeriod,
    healthTimeout: healthTimeout,
  );
}