Working with Containers in Container Instances

This section describes how to view information about containers in container instances, retrieve log data from a container instance container, and update the name and tags of a container instance container.

Viewing Container Instance Containers

This topic describes how to list all containers for a compartment or a container instance and how to view more information about a specified container instance container.

Using the Compute Web UI

  1. On the dashboard, select Containers / Container Instances.

    If the container instance that you want to view is not listed, use the Compartment drop-down menu above the container instances list to select the correct compartment.

  2. In the container instances list, select the name of the container instance for which you want to view the container.

  3. On the container instance details page, scroll to the Resources section, and select Containers.

  4. Select the name of the container in the list to show more information about the container, including log data.

Using the OCI CLI

  1. List all containers in a specified compartment.

    1. Get the OCID of the compartment where you want to list containers: oci iam compartment list

    2. Run the list containers command.

      $ oci container-instances container list --compartment-id ocid1.compartment.unique_ID
  2. List the container in a specified container instance.

    1. Get the OCID of the container instance for which you want to view the container: oci container-instances container-instance list

    2. Run the get container instance command to list the container in the container instance.

      $ oci container-instances container-instance get --container-instance-id ocid1.container-instance.unique_ID
  3. Get more information about a specific container.

    1. Get the OCID of the container by using one of the two list containers commands.

    2. Run the get container command.

      $ oci container-instances container get --container-id ocid1.container.unique_ID
  4. Retrieve log data from a specific container.

    1. Get the OCID of the container by using one of the two list containers commands.

    2. Retrieve the most recent 256 KB of logs from the specified container.

      $ oci container-instances container retrieve-logs --container-id ocid1.container.unique_ID

Updating a Container Instance Container

You can change the name and tags of a specified container instance container.

Using the Compute Web UI

  1. On the dashboard, select Containers / Container Instances.

  2. In the container instances list, select the name of the container instance for which you want to update the container.

  3. On the container instance details page, scroll to the Resources section, and select Containers.

  4. For the container in the list, select the Actions menu and select Edit.

Using the OCI CLI

  1. Get the OCID of the container that you want to update by using one of the following list containers commands:

    $ oci container-instances container list --compartment-id compartment_OCID
    $ oci container-instances container-instance get --container-instance-id ocid1.container-instance.unique_ID
  2. Run the update container command.

    Example:

    $ oci container-instances container update --container-id ocid1.container.unique_ID \
    --display-name new_name --defined-tags new_tags --force