Creating an Image

To launch a compute instance in Oracle Cloud Infrastructure, you must create or import an image in the Oracle Cloud Infrastructure Compute tenancy.

The topic includes the following tasks:

Creating a Custom Linux Image

Create an instance in your Oracle Cloud Infrastructure tenancy, and then install your application on this instance. After installing the application on this instance, create a custom image in Oracle Cloud Infrastructure. Follow the image guidelines while creating the custom image.

Follow the instructions provided in this section to create a custom Linux image. To create a custom Windows image, see Creating a Generalized Image.To create a custom Linux image, do the following:

  1. Create a Linux instance in your Oracle Cloud Infrastructure tenancy. See Creating an Instancein Oracle Cloud Infrastructure documentation.
  2. Note down the IP address of the instance that you have created, and then SSH to the instance.
  3. Install your application on the Linux instance.
  4. Ensure that your application is scheduled to run on every instance boot. You can manage operation system controls of the instance to achieve this.
    Note

    Oracle doesn't recommend you to schedule software installation during instance boot as this could affect your customer's experience.

  5. Optional. You can add an identifier that this image will be used from the marketplace.
  6. Remove all sensitive data such as key files and password which you don't want to share with your customers. To remove such files, use the oci-image-cleanup utility. The oci-image-cleanup utility is already installed on all Oracle Linux images provided by Oracle Cloud Infrastructure. For all other operating systems, use the oci-image-cleanup utility provided by the oci-utils package on GitHub.
    Note

    When you clear the SSH keys using the oci-image-cleanup utility, you won't be able to login to this instance with your existing credentials. You will need to create a new custom image of this instance, and then create a new Compute instance from that custom image to login.
  7. Create a custom image of the instance on which you have installed your application. See To create a custom image in Oracle Cloud Infrastructure documentation.
  8. Open the navigation menu. Under Core Infrastructure, go to Compute and click Custom Images. The list of custom images is displayed.
  9. Click the custom image that you have created to view its details and copy the OCID of the custom image.
  10. Launch an instance from the new image. See Managing Custom Imagesin Oracle Cloud Infrastructure documentation.

Creating a Generalized Image

Generalized images are images that have been cleaned of instance-specific information. It has a generalized OS disk, cleaned of computer-specific information. The images are generalized using Sysprep. Generalized images can be configured to re-create the opc user account, including generating a new, random password that you retrieve using the API.

Note

Creating a generalized image from an instance will render the instance non-functional, so you should first create a custom image from the instance, and then launch a new instance from the custom image. Steps 1 - 2 describe how to do this. This is the instance that you'll generalize. Alternatively, you can make a backup image of the instance that you can use to launch a replacement instance if needed.

Note

If you upgrade to PowerShell 5.0/WMF 5.0, you may encounter an issue where Sysprep fails which will prevent the image generalization process from completing. If this occurs, you may not be able to log into instances launched from the custom image. See Known Issues in Oracle Cloud Infrastructure documentation to work around the issue.

To create a generalized image, do the following:

  1. Create the new image using Managing Custom Imagesin Oracle Cloud Infrastructure documentation.
  2. Launch an instance from the new image. See Managing Custom Imagesin Oracle Cloud Infrastructure documentation.
  3. Connect to the instance using a Remote Desktop client.
  4. Go to Creating Windows Custom Images and download to the instance the file matching the Windows version for the instance.
  5. Right-click the file, and then click Run as administrator.
  6. Extract the files to C:\Windows\Panther. The following files are extracted into the Panther folder for all Windows Server versions:
    • Generalize.cmd
    • Specialize.cmd
    • unattend.xml
    • Post-Generalize.ps1
  7. Leave the imageType setting defaulted to general to recreate the opc user account when a new instance is launched from the image. The new account's password can be retrieved using the API. See GetInstanceDefaultCredentials API in Oracle Cloud Infrastructure documentation.
  8. Right-click Generalize.cmd, and then click Run as administrator. Consider the following outcomes of running this command:
    • Your connection to the Remote Desktop client might immediately be turned off and you will be logged out of the instance. If this does not occur, you should log out of the instance yourself.
    • Because sysprep generalize turns off Remote Desktop, you won't be able to log in to the instance again.
    • Creating a generalized image essentially destroys the instance's functionality.

    You should wait for a few minutes before proceeding to the following step to ensure the generalization process has completed.

  9. Create the new image. See Managing Custom Imagesin Oracle Cloud Infrastructure documentation.
  10. After you create an image from an instance that has been generalized, we recommend that you stop the instance. Although it might appear to be running, it won't be fully operable.