service create
POST /services/create
Example request:
Example response:
Json parameters:
Name – Service name
Labels – A list of labels in format key=value.
Image – A string specifying the image name to use for the container.
Entrypoint – The entrypoint to run when starting the container.
Cmd – The command to run when starting the container.
Env – A list of environment variables in the form of ["VAR=value"[,"VAR2=value2"]].
WorkingDir – A string specifying the working directory for commands to run in.
Volumes - A list of volumes in format
volume_name:container_path:ro
.TTY - Indicates whether allocates a pseudo-TTY.
Stdin - Keep STDIN open even if not attached.
NetMode - Connect containers to a network, only bridge is supported now.
StopSignal - Signal to stop a container, SIGTERM by default.
SecurityGroups - Security group for the container.
ServicePort - Serving port of the service.
ContainerPort - Container port of this serivce (default same with service port).
ContainerSize - The size of service containers (e.g. s1, s2, s3, s4, m1, m2, m3, l1, l2, l3).
Replicas - Number of containers belonging to this service.
Protocol - Service protocol (e.g. http, https, tcp, httpsTerm).
SSLCert - SSL cert for httpsTerm services (Only for httpsTerm).
HealthCheckInterval - Interval in seconds for health checking the service backends.
HealthCheckFall - Number of consecutive valid health checks before considering the server as DOWN.
HealthCheckRise - Number of consecutive valid health checks before considering the server as UP.
Algorithm - The algorithm of the service (e.g. roundrobin, leastconn, source).
SessionAffinity - Whether the service uses sticky sessions.
Status Codes:
201 – no error
409 – name conflicts with an existing object
500 - server error
Last updated