Create a Deployment

post

/api/v2/deployments/

To create a new deployment, you provide Docker YAML code that defines the elements of the deployment. You include the YAML code in the content parameter in the body of the request.

Request

Supported Media Types
Body ()
Body parameters
Root Schema : schema
Type: object
Show Source
Nested Schema : placement
Type: object
Show Source
Nested Schema : quantities
Type: object
Show Source
Nested Schema : stack
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
Nested Schema : deployment
Type: object
Show Source
Nested Schema : placement
Type: object
Show Source
Nested Schema : quantities
Type: object
Show Source
Nested Schema : stack
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 create a new Oracle Container Cloud Service deployment by submitting a POST request on 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 -ski 
     -X "POST" 
     -H "Authorization: Bearer 53e024fb32c05723" "https://rest_server_url/api/v2/deployments/"
     --data "@create_deployment.json"

Contents of the create_deployment.json file

The following example shows how to define a deployment, using a JSON file. You can then pass this JSON file to the endpoint, using a cURL command.

Note when providing the YAML code within the content parameter, you must use the escape character (\) to identify line breaks (/n), quotation marks, and backslash (\) characters.

{
     "deployment_id":"NGINX1-20160919-123512",
     "deployment_name":"NGINX1",
     "desired_state":1,
     "placement":{"pool_id":"default"},
     "quantities":{"nginx":1},"stack":
        {
          "content":"version: 2\nservices:\n  nginx:\n    image: \"nginx:1.10.1-alpine\"\n    environment:\n      - \"NGINX_CONF=server {\\\\n  listen 80;\\\\n  server_name localhost;\\\\n  location / {\\\\n    add_header Content-Type text/plain;\\\\n    return 200 'Hello from your Docker container';\\\\n  }\\\\n}\"\n      - \"occs:availability=per-pool\"\n      - \"occs:scheduler=random\"\n      - \"occs:description=This is the official NGINX image. This example is provided as-is for educational purposes and should not be used in production.\"\n    ports:\n      - \"8001:80/tcp\"\n    command: \"sh -c \\\"echo -e \\\\$NGINX_CONF > /etc/nginx/conf.d/default.conf; nginx -g 'daemon off;'\\\"\"\n",
          "service_id":"nginx",
          "service_name":"NGINX1",
          "subtype":"service"
       }
}
Back to Top