GPU-Docker-API-Official
  1. ReplicaSet
GPU-Docker-API-Official
  • ReplicaSet
    • Run a container via replicaSet
      POST
    • Commit container as an image via replicaSet
      POST
    • Execute a command in the container via replicaSet
      POST
    • Patch a container via replicaSet
      PATCH
    • Rollback a container via replicaSet
      PATCH
    • Stop a container via replicaSet
      PATCH
    • Restart a container via replicaSet
      PATCH
    • Pause a replicaSet via replicaSet
      PATCH
    • Continue a replicaSet via replicaSet
      PATCH
    • Get version info about replicaSet
      GET
    • Get all version info about replicaSet
      GET
    • Delete a container via replicaSet
      DELETE
  • Volume
    • Create a volume
      POST
    • Patch a volume
      PATCH
    • Get version info about a volume
      GET
    • Get all version info about a volume
      GET
    • Delete a volume
      DELETE
  • Resource
    • Get gpu usage status
      GET
    • Get port usage status
      GET
  1. ReplicaSet

Run a container via replicaSet

POST
/api/v1/replicaSet
Run a container consists of two parts: create and start.
When the container is created, the creation information is saved to etcd.
ReplicaSet is just an abstract concept, there is no concrete implementations,it just has to manage docker container, and save the container historical version information, that's all.

Request

Body Params application/json
imageName
string 
required
It's not automatically download from docker hub, you need to pull it locally first.
replicaSetName
string 
required
Cannot cotainer '-', ReplicaSet managed containers will add version numbers, e.g. foo-0, foo-1.
gpuCount
integer 
required
If gpuCount is 0, the gpu is not used.
binds
array [object {2}] 
required
Bind mounts
src
string 
required
If starts with /, mounts the host's folders or files into the container.If it does not start with /, mount the docker volume into the container.
dest
string 
required
Cannot mount to root direcotry('/').
env
array[string]
required
Environment variable, the format is like foo=bar.
containerPorts
array[string]
required
The port number inside the container, with a randomly assigned host port number bound to it.
Example
{
  "imageName": "nvidia/cuda:10.0-base",
  "replicaSetName": "foo",
  "gpuCount": 3,
  "binds": [
    {
      "src": "veil-0",
      "dest": "/root/veil-0"
    },
    {
      "src": "/mynfs/data/ctr-knock",
      "dest": "/root/data/ctr-knock"
    }
  ],
  "env": [
    "USER=foo"
  ],
  "containerPorts": [
    "22",
    "443"
  ]
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://127.0.0.1:2378/api/v1/replicaSet' \
--header 'Content-Type: application/json' \
--data-raw '{
    "imageName": "nvidia/cuda:10.0-base",
    "replicaSetName": "foo",
    "gpuCount": 3,
    "binds": [
        {
            "src": "veil-0",
            "dest": "/root/veil-0"
        },
        {
            "src": "/mynfs/data/ctr-knock",
            "dest": "/root/data/ctr-knock"
        }
    ],
    "env": [
        "USER=foo"
    ],
    "containerPorts": [
        "22",
        "443"
    ]
}'

Responses

🟢200OK
application/json
Body
code
integer 
required
msg
string 
required
data
object 
required
name
string 
required
Container name of the new version created
Example
{
  "code": 200,
  "msg": "Success",
  "data": {
    "name": "foo-1"
  }
}
Modified at 2024-01-23 02:24:35
Previous
ReplicaSet
Next
Commit container as an image via replicaSet
Built with