Managing Machine Images

A machine image is a hard disk snapshot used to launch a virtual machine instance. The machine image archive must be a single raw disk image (including partition table and kernel) stored at the root of a tar archive and compressed with gzip. All machine images must be based on the Oracle Public Cloud Machine templates. A machine image template can be created only by a Oracle Cloud Administrator. For more information about building machine images and templates, see Using Oracle Compute Cloud Service.

add machineimage

This command enables you to add a new machine image to the system.

Note:

You can add only private machine images to the system. To make a public machine image on the system, contact your Oracle Cloud Administrator.

Syntax

oracle-compute add machineimage name file [--attributes] [--quota]

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Parameter Description
name A unique hierarchical name for the machine image. For example, /mytenant/public/mymachineimage.

Object names can contain only alphanumeric characters, hyphens, and periods. Object names are case-sensitive.

file Name of the file containing the disk image (.tar.gz)
--attributes

(Optional) User-defined parameters that can be passed to an instance of this machine image when it is launched. These parameters are passed as JSON objects. Syntax (key/value pairs): '{ "key1": "value1", "key2": "value2" }'

User-defined parameters that can be passed to an instance of this machine image when it is launched. These parameters are passed as JSON objects.

For example, you can specify the location of a database server and login details, which are then passed to the machine image during launch.

For more information about attributes, see Orchestration Templates in Using Oracle Compute Cloud Service.

--quota (Optional)  The quota against which this image will be created

Example

$ oracle-compute add machineimage /mytenant/public/mymachineimage image.tar.gz

delete machineimage

This command enables you to delete an existing machine image.

Note:

You can delete only those private machine images that you have created.

Syntax

oracle-compute delete machineimage name

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Parameter Description
name A unique hierarchical name for the machine image. For example, /mytenant/public/mymachineimage.

Example

$ oracle-compute delete machineimage /mytenant/public/mymachineimage

download machineimage

This command enables you to download one or more machine images.

Syntax

oracle-compute download machineimage path [--outputdir]

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Parameter Description
path The full path name of your machine image. You can specify either the full path name of a single machine image, or a container. If a container is specified, then all machine images in that container are downloaded.
--outputdir (Optional) Specifies the directory to which all the machine images will be downloaded

Example

$ oracle-compute download machineimage /oracle/public/oel6

Retrieve Machine Image Details

You can view machine image details by using the CLI.

discover machineimage

This command enables you to discover machine images in a specific container.

Syntax

oracle-compute discover machineimage container

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Parameter Description
container Hierarchical name-space for machine images

Example

$ oracle-compute discover machineimage /oracle/public

Sample Output

$ oracle-compute discover machineimage /oracle/public
entry
/oracle/public/linux5_16.1.2_64                      
/oracle/public/linux6_16.1.2_64                      
/oracle/public/linux6_12.2.1.0.0_64_jaas_16.2.1.0.103

get machineimage

This command enables you to retrieve information for a specific machine image.

Syntax

oracle-compute get machineimage name

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Parameter Description
name A unique hierarchical name for the machine image. For example, /mytenant/public/mymachineimage.

Example

oracle-compute get machineimage /oracle/public/linux6_16.1.2_64 -f json

Sample Output

$ oracle-compute get machineimage /oracle/public/linux6_16.1.2_64 -f json 
{
 "list": [
  {
   "name": "/oracle/public/linux6_16.1.2_64", 
   "sizes": {
    "uploaded": 2176821211, 
    "total": 2176821211, 
    "decompressed": 19327352832
   }, 
   "no_upload": false, 
   "quota": null, 
   "uri": "https://api/machineimage/oracle/public/linux6_16.1.2_64", 
   "state": "available", 
   "signed_by": null, 
   "file": "https://api:443/machineimage/oracle/public/linux6_16.1.2_64", 
   "checksums": null, 
   "attributes": {}, 
   "error_reason": null, 
   "audited": null
  }
 ]
}

list machineimage

This command enables you to retrieve information for the machine images in a specific container.

Syntax

oracle-compute list machineimage container [--quota]

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Note:

The output of this command is filtered based on the optional parameters (if specified).
Parameter Description
container Hierarchical name-space for machine images
--quota (Optional) Quota associated with the image

Example

$ oracle-compute list machineimage /oracle/public

Sample Output

$ oracle-compute list machineimage /oracle/public -F name,quota,state 
name                                                  quota    state  
/oracle/public/linux5_16.1.2_64                       None     available  
/oracle/public/linux6_16.1.2_64                       None     available  
/oracle/public/linux6_12.2.1.0.0_64_jaas_16.2.1.0.103 None     available