Images

An image contains the software packages that will be available on newly-provisioned instance. In the case of hardware virtual machines, the image also includes the operating system.

ListImages (GET /:login/images)

Provides a list of images available in this datacenter.

Note: Currently, Docker images are not included in this endpoint's responses. You must use docker images against the docker service for this datacenter.

Inputs

The following optional query parameters are available to filter the list of images:

Returns

An array of images. Image objects include the following fields:

Errors

For all possible errors, see CloudAPI HTTP Responses.

CLI Command

triton image list

or

sdc-listimages

Example Request

GET /my/images HTTP/1.1
Host: api.example.com
Authorization: Signature keyId...
Accept: application/json
Api-Version: ~8

Example Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 611
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Api-Version, Response-Time
Access-Control-Allow-Methods: GET, HEAD, POST
Access-Control-Expose-Headers: Api-Version, Request-Id, Response-Time
Connection: Keep-Alive
Content-MD5: 9eDxMdIxc+3aED7Z3qyL8w==
Date: Thu, 21 Jan 2016 07:57:59 GMT
Server: Joyent Triton 8.0.0
Api-Version: 8.0.0
Request-Id: af34a510-c014-11e5-9c73-6767e338bf5d
Response-Time: 1506

[
  {
    "id": "2b683a82-a066-11e3-97ab-2faa44701c5a",
    "name": "base",
    "version": "13.4.0",
    "os": "smartos",
    "requirements": {},
    "type": "zone-dataset",
    "description": "A 32-bit SmartOS image with just essential packages installed. Ideal for users who are comfortable with setting up their own environment and tools.",
    "files": [
      {
        "compression": "gzip",
        "sha1": "3bebb6ae2cdb26eef20cfb30fdc4a00a059a0b7b",
        "size": 110742036
      }
    ],
    "tags": {
      "role": "os",
      "group": "base-32"
    },
    "homepage": "https://docs.joyent.com/images/smartos/base",
    "published_at": "2014-02-28T10:50:42Z",
    "owner": "930896af-bf8c-48d4-885c-6573a94b1853",
    "public": true,
    "state": "active"
  },
  ...
]

GetImage (GET /:login/images/:id)

Gets an individual image by id.

Inputs

None

Returns

Possible error.code values:

Errors

For all possible errors, see CloudAPI HTTP Responses.

CLI Command

triton image get 2b683a82-a066-11e3-97ab-2faa44701c5a

or

sdc-getimage 2b683a82-a066-11e3-97ab-2faa44701c5a

Example Request

GET /my/images/2b683a82-a066-11e3-97ab-2faa44701c5a HTTP/1.1
Host: api.example.com
Authorization: Signature keyId...
Accept: application/json
Api-Version: ~8

Example Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 609
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Api-Version, Response-Time
Access-Control-Allow-Methods: GET, HEAD, POST, DELETE
Access-Control-Expose-Headers: Api-Version, Request-Id, Response-Time
Connection: Keep-Alive
Content-MD5: 42n5PWY5xZP0lnjdMb7Omg==
Date: Thu, 21 Jan 2016 08:00:09 GMT
Server: Joyent Triton 8.0.0
Api-Version: 8.0.0
Request-Id: fd5679d0-c014-11e5-a8f8-951890fd520a
Response-Time: 876

{
  "id": "2b683a82-a066-11e3-97ab-2faa44701c5a",
  "name": "base",
  "version": "13.4.0",
  "os": "smartos",
  "requirements": {},
  "type": "zone-dataset",
  "description": "A 32-bit SmartOS image with just essential packages installed. Ideal for users who are comfortable with setting up their own environment and tools.",
  "files": [
    {
      "compression": "gzip",
      "sha1": "3bebb6ae2cdb26eef20cfb30fdc4a00a059a0b7b",
      "size": 110742036
    }
  ],
  "tags": {
    "role": "os",
    "group": "base-32"
  },
  "homepage": "https://docs.joyent.com/images/smartos/base",
  "published_at": "2014-02-28T10:50:42Z",
  "owner": "930896af-bf8c-48d4-885c-6573a94b1853",
  "public": true,
  "state": "active"
}

DeleteImage (DELETE /:login/images/:id)

Delete an image. Caller must be the owner of the image to delete it.

Inputs

None

Returns

Responds with HTTP 204 'No Content'.

Errors

For all possible errors, see CloudAPI HTTP Responses.

CLI Command

triton image delete 2b683a82-a066-11e3-97ab-2faa44701c5a

or

sdc-deleteimage 2b683a82-a066-11e3-97ab-2faa44701c5a

Example Request

DELETE /my/images/2b683a82-a066-11e3-97ab-2faa44701c5a HTTP/1.1
Authorization: ...
Host: api.example.com
Accept: application/json
Api-Version: ~8

Example Response

HTTP/1.1 204 No Content
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Api-Version, Response-Time
Access-Control-Allow-Methods: GET, HEAD, POST, DELETE
Access-Control-Expose-Headers: Api-Version, Request-Id, Response-Time
Connection: Keep-Alive
Content-MD5: 83MuHssrpOMWvPXLB9stgg==
Date: Thu, 21 Jan 2016 08:02:08 GMT
Server: Joyent Triton 8.0.0
Api-Version: 8.0.0
Request-Id: 440f5590-c015-11e5-b5f9-2b49303f7fc4
Response-Time: 1262

ExportImage (POST /:login/images/:id?action=export)

Exports an image to the specified Manta path. Caller must be the owner of the image, and the correspondent Manta path prefix, in order to export it. Both the image manifest and the image file will be exported, and their filenames will default to the following format when the specified manta path is a directory:

<manta_path>/NAME-VER.imgmanifest
<manta_path>/NAME-VER.zfs.FILE-EXT

Where NAME is the image name and VER is the image version. FILE-EXT is the file extension of the image file. As an example, exporting a foo-1.0.0 image to /user/stor/cloudapi would result in the following files being exported:

/user/stor/cloudapi/foo-1.0.0.imgmanifest
/user/stor/cloudapi/foo-1.0.0.zfs.gz

By contrast, if the basename of the given prefix is not a directory, then "MANTA_PATH.imgmanifest" and "MANTA_PATH.zfs[.EXT]" are created. As an example, the following shows how to export foo-1.0.0 with a custom name:

/my/images/<uuid>?action=export&manta_path=/user/stor/my-image

/user/stor/my-image.imgmanifest
/user/stor/my-image.zfs.gz

Inputs

Returns

A Manta location response object. It provides the properties that allow a CloudAPI user to retrieve the image file and manifest from Manta: manta_url, image_path, manifest_path.

Errors

For all possible errors, see CloudAPI HTTP Responses.

CLI Command

sdc-exportimage --mantaPath=/user/stor/my-image 0c428eb9-7f03-4bb0-ac9f-c0718945d604

Example Request

POST /my/images/e42f8c84-bbea-11e2-b920-078fab2aab1f?action=export&manta_path=/user/stor/my-image HTTP/1.1
Authorization: ...
Host: api.example.com
Accept: application/json
Api-Version: ~8

Example Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 150
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Api-Version, Response-Time
Access-Control-Allow-Methods: GET, HEAD, POST, DELETE
Access-Control-Expose-Headers: Api-Version, Request-Id, Response-Time
Connection: Keep-Alive
Content-MD5: qSUhN+dwdJKEFlcyrUdBiw==
Date: Thu, 21 Jan 2016 08:00:09 GMT
Server: Joyent Triton 8.0.0
Api-Version: 8.0.0
Request-Id: 8180ad80-14ef-11e3-a62d-89e8106c294e
Response-Time: 670

{
  "manta_url": "https://us-east.manta.joyent.com",
  "image_path": "/user/stor/my-image.zfs.gz",
  "manifest_path": "/user/stor/my-image.imgmanifest"
}

CreateImageFromMachine (POST /:login/images)

Create a new custom image from an instance. The typical process is:

  1. Customize an instance the way you want it.

  2. Call this endpoint (CreateImageFromMachine) to create a new image.

  3. Repeat from step 1 if more customizations are desired with different images.

  4. Use the new image(s) for provisioning via CreateMachine.

Inputs

All inputs except machine are image manifest fields as defined by the IMGAPI docs. Note that not all fields listed there can be specified here.

Returns

Errors

For general errors, see CloudAPI HTTP Responses. Some typical and specific errors for this endpoint:

Example CLI Command

triton image create a44f2b9b-e7af-f548-b0ba-4d9270423f1a my-custom-image 1.0.0

or

sdc-createimagefrommachine --machine=a44f2b9b-e7af-f548-b0ba-4d9270423f1a --name=my-custom-image --imageVersion=1.0.0

Example HTTP Request

POST /my/images HTTP/1.1
Authorization: ...
Host: api.example.com
Accept: application/json
Api-Version: ~8

{
  "machine": "a44f2b9b-e7af-f548-b0ba-4d9270423f1a",
  "name": "my-custom-image",
  "version": "1.0.0"
}

Example HTTP Response

HTTP/1.1 201 Created
x-joyent-jobid: 0b30ef20-d622-436a-9c30-7376ba7d904c
Location: /admin/images/b87616a2-7a49-4e02-a71d-2e0ce5a2f037
Content-Type: application/json
Content-Length: 125
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Api-Version, Response-Time
Access-Control-Allow-Methods: GET, HEAD, POST
Access-Control-Expose-Headers: Api-Version, Request-Id, Response-Time
Connection: Keep-Alive
Content-MD5: 2sEZ45LmhRiretMPn5sqVA==
Date: Thu, 21 Jan 2016 08:00:09 GMT
Server: Joyent Triton 8.0.0
Api-Version: 8.0.0
Request-Id: 88af23b0-f952-11e2-8f2c-fff0ec35f4ce
Response-Time: 160

{
    "id": "62306cd7-7b8a-c5dd-d44e-8491c83b9974",
    "name": "my-custom-image",
    "version": "1.2.3",
    "requirements": {},
    "owner": "47034e57-42d1-0342-b302-00db733e8c8a",
    "public": false,
    "state": "creating"
}

ImportImageFromDatacenter (POST /:login/images?action=import-from-datacenter)

This will copy the image with id from the source datacenter into this datacenter. The copied image will retain all fields (e.g. id, published_at) as the original image. All incremental images in the origin chain will also be copied.

You can use triton datacenters to view the list of datacenter names in the current cloud.

Inputs

The following query parameters are required, these parameters will be used to identify the image to be copied.

Returns

On success, an Image object is returned. See GetImage for the fields that are returned in the image object.

Errors

For general errors, see CloudAPI HTTP Responses. Some typical and specific errors for this endpoint:

Example CLI Command

triton image copy 7eed8e50-e452-428d-9131-bf056aa911bd us-west-1

Example HTTP Request

POST /my/images?action=import-from-datacenter&datacenter=us-west-1&id=7eed8e50-e452-428d-9131-bf056aa911bd HTTP/1.1
Authorization: ...
Host: api.example.com
Accept: application/json
Api-Version: ~9

{}

Example HTTP Response

HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 125
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Api-Version, Response-Time
Access-Control-Allow-Methods: GET, HEAD, POST
Access-Control-Expose-Headers: Api-Version, Request-Id, Response-Time
Connection: Keep-Alive
Content-MD5: 2sEZ45LmhRiretMPn5sqVA==
Date: Thu, 21 Jan 2018 08:00:09 GMT
Server: cloudapi/9.2.0
Api-Version: 9.0.0
Request-Id: 49af23b0-f952-11e2-8f2c-fff0ec35f4ce
Response-Time: 460

{
  "id": "7eed8e50-e452-428d-9131-bf056aa911bd",
  "name": "myimage",
  "version": "1.4.0",
  "os": "smartos",
  "requirements": {},
  "type": "zone-dataset",
  "description": "A custom image used to test stuff.",
  "files": [
    {
      "compression": "gzip",
      "sha1": "3bebb6ae2cdb26eef20cfb30fdc4a00a059a0b7b",
      "size": 110742036
    }
  ],
  "published_at": "2015-02-28T10:50:42Z",
  "owner": "930896af-bf8c-48d4-885c-6573a94b1853",
  "public": false,
  "state": "active"
}

UpdateImage (POST /:login/images/:id?action=update)

Updates metadata about an image.

Inputs

Only the image attributes listed below can be updated.

Returns

An updated image object.

Errors

For general errors, see CloudAPI HTTP Responses. Some typical and specific errors for this endpoint:

Example CLI Command

sdc-updateimage --name=my-renamed-image eca995fe-b904-11e3-b05a-83a4899322dc

Example HTTP Request

POST /my/images/eca995fe-b904-11e3-b05a-83a4899322dc?action=update HTTP/1.1
Authorization: ...
Host: api.example.com
Accept: application/json
Api-Version: ~8

{
  "name": "my-renamed-image",
}

Example HTTP Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 125
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Api-Version, Response-Time
Access-Control-Allow-Methods: GET, HEAD, POST
Access-Control-Expose-Headers: Api-Version, Request-Id, Response-Time
Connection: Keep-Alive
Content-MD5: 2sEZ45LmhRiretMPn5sqVA==
Date: Thu, 21 Jan 2016 08:00:09 GMT
Server: Joyent Triton 8.0.0
Api-Version: 8.0.0
Request-Id: b8e43c60-b904-11e3-93b7-1f685001b0c3
Response-Time: 135

{
  "id": "eca995fe-b904-11e3-b05a-83a4899322dc",
  "name": "my-renamed-image",
  "version": "1.0.0",
  "os": "smartos",
  "requirements": {},
  "type": "zone-dataset",
  "published_at": "2013-11-25T17:44:54Z",
  "owner": "47034e57-42d1-0342-b302-00db733e8c8a",
  "public": true,
  "state": "active"
}

CloneImage (POST /:login/images/:id?action=clone)

Creates an independent copy of the source image. The login account must be on the source image ACL to be able to make an image clone.

The resulting cloned image will have the same properties as the source image, but the cloned image will have a different id, it will be owned by the login account and the image will have an empty ACL.

All incremental images in the image origin chain that are not operator images (i.e. are not owned by admin) will also be cloned, though all cloned incremental images will have state disabled so that they are not visible in the default image listings.

Inputs

None.

Returns

A cloned image object. See GetImage docs for the image fields returned.

Errors

For general errors, see CloudAPI HTTP Responses. Some typical and specific errors for this endpoint:

Example CLI Command

triton image clone eca995fe-b904-11e3-b05a-83a4899322dc

Example HTTP Request

POST /my/images/eca995fe-b904-11e3-b05a-83a4899322dc?action=clone HTTP/1.1
Authorization: ...
Host: api.example.com
Accept: application/json
Api-Version: ~8

Example HTTP Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 125
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Api-Version, Response-Time
Access-Control-Allow-Methods: GET, HEAD, POST
Access-Control-Expose-Headers: Api-Version, Request-Id, Response-Time
Connection: Keep-Alive
Content-MD5: 2sEZ45LmhRiretMPn5sqVA==
Date: Thu, 21 Jan 2016 08:00:09 GMT
Server: Joyent Triton 8.0.0
Api-Version: 8.0.0
Request-Id: f8e43c60-b904-11e3-93b7-1f685001b0c3
Response-Time: 135

{
  "id": "4ca995fe-b904-11e3-b05a-83a4899322dc",
  "name": "some-image",
  "version": "1.0.0",
  "os": "smartos",
  "requirements": {},
  "type": "zone-dataset",
  "published_at": "2017-11-25T17:44:54Z",
  "owner": "77034e57-42d1-0342-b302-00db733e8c8a",
  "public": true,
  "state": "active"
}

Last updated