Run a Container from an Image

post

/api/v2/images/{repo_id:.*}/hosts/{host_id}/run

Use this endpoint to run a container from a specific image on a specific host. You identify the image by its registry repository name and optionally by its container tag. Note that the optional container tag must be preceded by a colon (:); for example, oraclelinux:6.6

Request

Supported Media Types
Path Parameters
Body ()
Body parameters
Root Schema : schema
Type: object
Show Source
Nested Schema : editorTemp
Type: object
Show Source
Nested Schema : struct
Type: object
Show Source
Security
Back to Top

Response

Supported Media Types

200 Response

200 Response
Body ()
Root Schema : schema
Type: array
Show Source
Nested Schema : items
Type: object
Show Source

Default Response

Error Payload
Body ()
Root Schema : schema
Type: array
Show Source
Back to Top

Examples

The following example shows how to run a container from a specific image. You perform this task by submitting a POST request to the REST resource using cURL. For more information about cURL, see Use cURL.

Note: The command in this example uses the URL structure https://rest_server_url/resource-path, where rest_server_url is the manager node for the Oracle Cloud Container instance. See Send Requests for the appropriate URL structure to use for Oracle Public Cloud.

cURL Command

curl -sk 
     -X "POST" 
     -H "Authorization: Bearer b39f09c71c297f1d" 
     "https://rest_server_url/api/v2/images/oraclelinux:6.6/hosts/host_id/run" 
     -d '{"content":"version: 2\nservices:\n  unnamed:\n    image: \"oraclelinux:6.6\"\n"}'

In this example, oraclelinux is the repository in the registry and 6.6 is the optional container tag. If you do not include the tag, then Oracle Container Cloud Service assumes the value of the tag is latest.

Example of Response Body

{
  "task_id": "602784b9-143c-4109-92d9-f66ff1010d07"
}
Back to Top