createService method
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,
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,
);
}