Creating an Image from an Instance

You can create a custom image of a compute instance's boot disk and use that custom image to launch other compute instances. Instances that you launch from this image include the customizations, configuration, and software that were installed on the boot disk when you created the image.

Custom images do not include the data from any attached block volumes.

Custom images inherit the compatible shapes that are set by default from the base image. For additional details to consider, refer to "Custom Images Created From Instances" in the Compute Instance Concepts chapter in the Oracle Private Cloud Appliance Concepts Guide.

The instance you use to create this custom image must be in the Stopped state.

Once the new custom image reaches the Available state, you can use it to launch new instances. See Creating an Instance.

Using the Compute Web UI

  1. Click Dashboard, and click the Compute/View Instances button.

  2. Select the compartment where the source instance is located.

  3. Click the name of the instance that you want to use as the basis for the custom image.

  4. Ensure that the instance is in the Stopped state.

    On the details page for the instance, click the Controls menu, and then click Stop.

    Wait for the instance status to change to Stopped. The status is displayed above the icon of the object.

  5. Click Controls and then click Create Custom Image.

  6. In the Create Image From Instance dialog, enter the following information:

    • Name: Replace the name with the name you want for the image.

    • Create in Compartment: Select the compartment where the image will be stored.

  7. Click the Create Custom Image button in the dialog.

    The status of the instance changes to Creating Image.

  8. Monitor the image creation progress.

    The time required to create the custom image depends on the size of the instance's boot volume.

    To monitor the progress, on the navigation menu, click Compute and then click Custom Images. Select the correct compartment, and click on the image name in the list. On the details page for the image, under Resources click Work Requests.

  9. (Optional) Restart the instance.

    When the instance status changes from Creating Image to Stopped, you can restart the instance.

Using the OCI CLI

  1. Gather the information that you need to run the command:

    • The OCID of the compartment where the new image will be located (oci iam compartment list)

    • The OCID of the instance that will provide the boot volume image as the basis for the custom image (oci compute instance list)

    • Display name for the new image

  2. Ensure that the instance is in the Stopped state.

    List the instance as described in Listing Images and Viewing Details. If lifecycle-state is not STOPPED, stop the instance as described in Stopping, Starting, and Resetting an Instance.

  3. Run the image create command.

    Syntax:

    oci compute image create --compartment-id compartment_OCID \
    --instance-id base_instance_OCID --display-name display_name

    Example:

    $ oci compute image create \
    --compartment-id ocid1.compartment.unique_ID \
    --instance-id ocid1.instance.unique_ID \
    --display-name "Oracle Linux 8"
    {
      "data": {
        "agent-features": null,
        "base-image-id": "ocid1.bootvolume.unique_ID",
        "billable-size-in-gbs": null,
        "compartment-id": "ocid1.compartment.unique_ID",
        "create-image-allowed": true,
        "defined-tags": {},
        "display-name": "Oracle Linux 8",
        "freeform-tags": {},
        "id": "ocid1.image.unique_ID",
        "launch-mode": "PARAVIRTUALIZED",
        "launch-options": null,
        "lifecycle-state": "PROVISIONING",
        "listing-type": null,
        "operating-system": "Custom",
        "operating-system-version": "Custom",
        "size-in-mbs": 0,
        "time-created": "2022-02-17T18:26:03.221604+00:00"
      },
      "etag": "3c0e56a0-b58c-486b-b659-9f5b13f377ee",
      "opc-work-request-id": "ocid1.workrequest.unique_ID"
    }
  4. (Optional) Restart the instance.

    When the instance lifecycle-state returns to STOPPED, you can restart the instance as described in Stopping, Starting, and Resetting an Instance.