Creating a Container Instance

A Roving Edge container instance includes a single container.

The following is the minimum information that you must provide to create a container instance:

  • The compartment where you want to create the container instance

  • The shape (see Container Instance Shapes)

  • The VCN and subnet

Container instances leverage 15 GB of ephemeral storage that's shared between the container instance and the container. This ephemeral storage is created automatically when the container instance is created. You can't manually create storage and attach it to the container instance.

    1. On the Roving Edge Device Console Dashboard, select Containers / Container Instances.

    2. Select Create Container Instance above the Container Instances list.

    3. In the Create Container Instance dialog box, enter the following information:

      • Name: Enter a name for the container instance. Instance names have the following characteristics:

        • Can be changed after the container instance is created.

        • Don't need to be unique.

        • Can contain only alphanumeric characters and the hyphen (-) character.

        • Can be a maximum of 63 characters.

      • General Information

        • Create in Compartment: Select the compartment where you want to create the container instance.

        • Fault Domain: (Optional) Select a fault domain. By default, the system automatically selects the best fault domain for the container instance when the instance is created. If you specify a fault domain, and the requested fault domain can't accommodate the container instance, instance create fails. The fault domain can be changed after the container instance is created.

      • Shape: Select either the CI.Standard.x86.Generic shape or the CI.Standard.E5.Flex shape.

        Use the sliders to specify the number of OCPUs you want, and the total amount of memory you want in gigabytes.

      • VNIC

        • Name: Enter the name of the VNIC. By default, the container instance name is used.

        • Networking

          • Private IP: (Optional) Enter the private IP address to use.

          • Hostname: (Optional) Enter a hostname if you are using DNS within the cloud network. The hostname must be unique across all VNICs in the subnet. By default, the container instance name is used for the hostname.

          • Assign Public IP: The box is selected by default. Clear the box if you don't want a public IP address to be assigned to this container instance.

        • Subnet

          1. VCN: Select a VCN from the list. You might need to change the compartment to the compartment where the VCN is located.

          2. Subnet: Select a subnet from the list.

        • Skip Source Destination Check: (Optional) Skip source destination check.

      • Container Image URL: Enter the container image URI. The container image must come from a registry that offers a certificate from a well know certificate authority (CA). Registries that offer self-signed certificates or certificates signed by a private CA are not supported at this time. The container image manifest must be V2 schema 2.

      • Environmental Variables: You can set the environmental variables used by the container. Container images support environment variables to customize their execution. For example, the official NGINX image supports NGINX_HOST and NGINX_PORT environment variables, so you can set the value to customize the execution to the following variables:
        • NGINX_HOST=foobar.com

        • NGINX_PORT=80

      • Command Arguments: You can specify the actual command or entrypoint the container runs upon starting, allowing you to start the main application, pass specific flags, or run custom scripts. Setting this value overrides or customizes the default command in the container image.

      • Memory Limit: You can set the maximum amount of RAM allocated to the shape configuration for the instance.

      • vCPU Limit: You can set the maximum number of virtual CPUs the shape configuration for the instance can utilize. This bounds the computational resources available.

      • Security: You can specify the security setting of the container.

        • Use the User ID and Group ID fields to set the user ID (ID) and group ID (GID) to run the entrypoint process of the container.
          • The value for User ID and Group ID must be an integer between 0 and 65535. The default value is 0.

          • The User ID and Group ID values that you specify override values that are set in the container image. When the User ID value is not specified, the entrypoint process of the container runs as root user.

          • You must set the User ID before you set the Group ID.

        • Configure Linux capabilities: You can configure Linux capabilities for your container. By default, the container launches with several capabilities that you can choose to drop.

          Both the Add capabilities field and Drop capabilities field support the ALL value, which allows or drops all capabilities. The value ALL refers to the Linux capabilities that are enabled by default.

          • If you leave both Add capabilities and Drop capabilities blank, all default capabilities are available for your container.

          • If you enter ALL in the Add capabilities field, all default capabilities are available except those that you list in the Drop capabilities field, and ignores ALL in the Drop capabilities field.

          • If you enter ALL in the Drop capabilities field, the container contains only the default capabilities that you list in the Add capabilities field.

          • For other cases, drops all the capabilities from the default set listed in the Drop capabilities field, then adds the capabilities listed in the Add capabilities field, and finally returns the result as the capability for your container.

          • The creation of the container instance fails if you provide any capabilities that are not in the list below.

            Capability

            Description

            CAP_AUDIT_WRITE

            Writes records to kernel auditing log.

            CAP_CHOWN

            Makes changes to file UIDs and GIDs.

            CAP_DAC_OVERRIDE

            Discretionary access control (DAC) that bypasses file read, write, and execute permission checks.

            CAP_FOWNER

            Bypasses permission checks on operations that normally require the file system UID of the process to match the UID of the file, excludes the operations that are covered by CAP_DAC_OVERRIDE and CAP_DAC_READ_SEARCH.

            CAP_FSETID

            • Does not clear set-user-ID and set-group-ID mode bits when a file is modified.
            • Sets the set-group-ID bit for a file whose GID does not match the file. system or any of the supplementary GIDs of the calling process.

            CAP_KILL

            Bypasses permission checks for sending signals, which includes use of the ioctl(2) KDSIGACCEPT operation.

            CAP_MKNOD

            Creates special files using mknod(2).

            CAP_NET_BIND_SERVICE

            Binds a socket to internet domain privileged ports (port numbers less than 1024).

            CAP_NET_RAW

            • Uses RAW and PACKET sockets.
            • Binds to any address for transparent proxying.

            CAP_SETFCAP

            Sets file capabilities.

            CAP_SETGID

            • Makes manipulations of process GIDs and supplementary GID list.

            • Forges GID when passing socket credentials via UNIX domain sockets.

            • Writes a group ID mapping in a user namespace.

            CAP_SETPCAP

            If the file capabilities are not supported, grants or removes any capability in the caller's permitted capability set to or from any other process.

            CAP_SETUID

            • Makes manipulations of process UIDs.

            • Forges UID when passing socket credentials via UNIX domain sockets.

            • Writes a user ID mapping in a user namespace.

            CAP_SYS_CHROOT

            Uses chroot(2) to change to a different root directory.

      • Tagging: (Optional) Add tags for this resource. Tags can also be applied later. See Using Resource Tags (IAM on the Device).

    4. Select Create Container Instance.

      The instance details page is displayed. On the Container Instance Information tab, the Shape Configuration section shows the shape, the number of OCPUs, the network bandwidth, and the total memory. The Primary VNIC column shows the VCN and subnet, the primary private IP address and any assigned public IP address, and the MAC address.

      To check the status of the container instance create, scroll to the Resources section and select Work Request(s).

      Select Containers in the Resources section. The container is named computecontainer-unique_ID.

  • Use the oci container-instances container-instance create command and required parameters to create a container instance.

    oci container-instances container-instance create --availability-domain AD-1 --compartment-id compartment_OCID --containers '[{"imageUrl": "image_url"}]' --shape shape --shape-config '{"ocpus": 2}' --vnics file://network_cofig.json [OPTIONS]

    Example:

    oci container-instances container-instance create --availability-domain AD-1 --compartment-id ocid1.compartment.unique_ID --containers file://container_config.json --shape CI.Standard.E5.Flex --shape-config '{"ocpus": 2,"memoryInGBs": 2}' --vnics '[{"subnetId": "ocid1.subnet.unique_ID"}]' 

    For a complete list of CLI commands, flags, and options, see the Command Line Reference.

    Procedure

    1. Get the following information:

      • The OCID of the compartment where you want to create the container instance: oci iam compartment list

      • The name of the shape to use. Use the following command to list the available shapes and their characteristics. Use the OCID of the compartment where you want to create the instance.

        $ oci container-instances container-instance list-shapes --compartment-id compartment_OCID

        You must also specify the shape configuration, as shown in the following example. You must provide a value for ocpus, and you can specify the memoryInGBs.

        --shape-config '{"ocpus": 2, "memoryInGBs": 2}'
      • The URL of the image to use to launch the container instance. Specify a container image from an external registry of your choice. The image must be signed by a well known Certificate Authority, and the image manifest must be an up-to-date version.

    2. Construct an argument for the --vnics option.

      This is a list of the networks available to the container on this container instance. For each VNIC, provide the name of the VNIC, the OCID of the subnet that you want to use, the private IP address, and whether a public IP address should be assigned.

      Use the following command to show the syntax for this argument:

      $ oci container-instances container-instance create --generate-param-json-input vnics
    3. Run the create container instance command.

      Syntax:

      Only the required parameters are shown.

      oci container-instances container-instance create --availability-domain AD-1 \
      --compartment-id compartment_OCID --containers '[{"imageUrl": "image_url"}]' \
      --shape shape --shape-config '{"ocpus": 2}' \
      --vnics file://network_cofig.json

      Example:

      If you set a display name for the container instance, see the Device Console procedure for characteristics.

      For a complete list of required and optional parameters, use the following command:

      $ oci compute instance launch -h
      $ oci container-instances container-instance create --availability-domain AD-1 \
      --compartment-id ocid1.compartment.unique_ID --containers file://container_config.json \
      --shape CI.Standard.E5.Flex --shape-config '{"ocpus": 2,"memoryInGBs": 2}' \
      --vnics '[{"subnetId": "ocid1.subnet.unique_ID"}]'

      View the work request to monitor the status of the container instance create. The work request OCID is returned in the container instance create output.

      $ oci container-instances work-request get --work-request-id ocid1.workrequest.unique_ID

      If the status of the container instance create is Failed, list the errors reported in the work request:

      $ oci container-instances work-request list-errors --work-request-id ocid1.workrequest.unique_ID
  • Use the CreateContainerInstance operation to create a container instance.

    For information about using the API and signing requests, see REST APIs and Security Credentials. For information about SDKs, see Software Development Kits and Command Line Interface.