Creating an Image

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

The page includes the following tasks:

Creating a Custom Linux Image

Create an instance in your OCI tenancy, and then install your application on this instance. After installing the application on this instance, create a custom image in OCI. 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 OCI tenancy. See Creating an Instancein the Compute documentation.
  2. Note down the IP address of the instance that you have created, and then use SSH to connect to the instance.
  3. Install your application on the Linux instance.
  4. Ensure that your application is scheduled to run every time that the instance starts. You can manage the operation system controls of the instance to achieve this.
    Note

    We don’t recommend scheduling software installation during instance start because it could affect your customer's experience.

  5. (Optional) Add an identifier that this image will be used from Marketplace.
  6. Remove all sensitive data such as key files and passwords, that 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 OCI. For all other operating systems, use the oci-image-cleanup utility provided by the oci-utils package on GitHub.
    Note

    When you use the oci-image-cleanup utility to clear the SSH keys, you won't be able to log in to this instance with your existing credentials. You must create a new custom image of this instance, and then create a new Compute instance from that custom image to log in.
  7. Create a custom image of the instance on which you have installed your application. See To create a custom image in the Compute documentation.
  8. From the navigation menu in the Oracle Cloud Console, select Compute and then select Custom Images. A list of the custom images in the current compartment is displayed.
  9. Click the custom image that you have created to view its details, and then copy the OCID of the custom image.
  10. Launch an instance from the new image. See Managing Custom Imagesin the Compute 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 by 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 and 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.

Tip

If you upgrade to PowerShell 5.0/WMF 5.0, you might encounter an issue where Sysprep fails, which prevents the image generalization process from completing. If this issue occurs, you may not be able to log in to instances launched from the custom image. See Known Issues in the Compute documentation for a workaround.

To create a generalized image, follow these steps:

  1. Create an image by using the steps in Managing Custom Images in the Compute documentation.
  2. Launch an instance from the new image. See Managing Custom Images in the Compute documentation.
  3. Connect to the instance by using a Remote Desktop client.
  4. Go to Creating Windows Custom Images and click the link in step 5 to download the Sysprep generalize file to 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 default value of general to recreate the opc user account when a new instance is launched from the image. The new account's password can be retrieved by using the API. See GetInstanceDefaultCredentials API in the OCI 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 doesn't 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 the Compute documentation.
  10. (Recommended) After you create an image from an instance that has been generalized, we recommend that you stop the instance. Although the instance might appear to be running, it won't be fully operable.