Hyper Docs
  • Introduction
  • What is Hyper
  • Why Hyper
  • Regions
  • Pricing
  • Quota and Limits
  • FAQ
  • Getting Started
    • Generate API Credential
    • Install CLI
    • Part 1 - Starting and inspecting your first container
    • Part 2 - Working with multiple containers
    • Part 3 - Hyper Compose
    • Migrate data
      • hyper container as client
      • hyper container as server
  • Features
    • Container
      • Container
      • Logs
      • Compose
      • Cron
      • Service
      • Func
    • Storage
      • Volume
      • Snapshot
    • Network
      • Network
      • Floating IP
      • Port
      • Security Group
    • Console
      • Filter
  • Reference
    • CLI
      • attach
      • commit
      • config
      • create
      • exec
      • images
      • info
      • inspect
      • kill
      • load
      • login
      • logout
      • logs
      • port
      • ps
      • pull
      • push
      • rename
      • restart
      • rm
      • rmi
      • run
      • search
      • start
      • stats
      • stop
      • version
      • update
      • wait
      • Volume
        • create
        • init
        • inspect
        • ls
        • rm
      • Snapshot
        • create
        • ls
        • rm
      • FIP
        • allocate
        • attach
        • detach
        • ls
        • release
        • name
      • Security Group
        • create
        • ls
        • inspect
        • rm
        • update
      • Compose
        • create
        • down
        • up
        • rm
        • ps
        • pull
        • run
        • kill
        • start
        • stop
        • scale
      • Service
        • create
        • ls
        • inspect
        • scale
        • rolling-update
        • attach-fip
        • detach-fip
        • rm
      • Cron
        • create
        • inspect
        • ls
        • history
        • rm
      • Func
        • create
        • update
        • inspect
        • ls
        • rm
        • logs
        • call
        • get
    • API
      • 2016-04-04 [Ver. 1.23]
        • Container
          • List Containers
          • Create a container
          • Get container logs
          • Start a container
          • Stop a container
          • Restart a container
          • Resize a container
          • Rename a container
          • Kill a container
          • Attach to a container
          • Remove a container
          • Update a container
          • Get container stats
          • Inspect a container
          • Exec Create
          • Commit a container
        • Event
          • Monitor events with WebSocket
        • Misc
          • Display system-wide information
          • Show the hyper version information
          • Exec Start
          • Exec Resize
          • Exec Inspect
        • Image
          • Inspect Images
          • Search Images
          • List Images
          • Load Images
          • Create an image
          • Remove an image
          • Push an image
        • Volume
          • List volumes
          • Create a volume
          • Remove a volume
          • Init a volume
          • Inspect a volume
        • Snapshot
          • Create a snapshot
          • List snapshots
          • Inspect a snapshot
          • Remove a snapshot
        • Network
          • Allocate floating IP
          • Attach a floating IP to a (running) container
          • Detach floating IP from a (running) container
          • List floating IP
          • Release floating IP
          • Name floating IP
        • Security Group
          • Create a security group
          • Remove a security group
          • Inspect a security group
          • Update a security group
          • List security groups
        • Service
          • service create
          • service list
          • service inspect
          • service update
          • service remove
        • Compose
          • Compose up
          • Compose create
          • Compose down
          • Compose rm
          • Compose start
          • Compose stop
          • Compose kill
        • Cron
          • Cron create
          • Cron list
          • Cron inspect
          • Cron remove
          • Cron history
        • Func
          • Func create
          • Func update
          • Func list
          • Func inspect
          • Func remove
          • Func call
          • Func get
          • Func logs
          • Func status
    • Compose File Reference
    • Security Group Reference
  • FAQ
    • Pricing
    • Quota and Limits
    • Privacy Policy
    • Terms of Service
    • Acceptable Use Policy
  • Docs version
Powered by GitBook
On this page
  1. Reference
  2. API
  3. 2016-04-04 [Ver. 1.23]
  4. Service

service create

POST /services/create

Example request:

POST /services/create HTTP/1.1
Content-Type: application/json

{
  "Name": "http",
  "Image": "nginx",
  "ContainerPort": 80,
  "Replicas": 2,
  "Protocol": "http",
  "ServicePort": 80,
  "Labels": {
    "app": "nginx"
  }
}

Example response:

HTTP/1.1 201 Created
Content-Type: application/json

{
  "Name": "http",
  "Image": "nginx",
  "WorkingDir": "",
  "ContainerSize": "s4",
  "SSLCert": "",
  "NetMode": "",
  "StopSignal": "",
  "ServicePort": 80,
  "ContainerPort": 80,
  "Replicas": 2,
  "HealthCheckInterval": 5,
  "HealthCheckFall": 3,
  "HealthCheckRise": 2,
  "Algorithm": "roundrobin",
  "Protocol": "http",
  "Stdin": false,
  "Tty": false,
  "SessionAffinity": false,
  "Entrypoint": null,
  "Cmd": null,
  "Env": null,
  "Volumes": null,
  "Labels": {
    "app": "nginx"
  },
  "SecurityGroups": null,
  "IP": "",
  "Tenant": "b8dc36865f4b480683dabb25598d61c4",
  "FIP": "",
  "Message": "Service is created",
  "Created": "2016-10-08T13:12:15.405946064Z",
  "Status": "created",
  "Containers": null
}

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

PreviousServiceNextservice list

Last updated 7 years ago