Create and Run Container

Using the Podman web console page, Cockpit administrators can create and run containers with registry images. The Podman page provides different options to create a container. For example, administrators can create a container from either the image table, container table, or inside an existing pod group.

What Do You Need?

  • The Cockpit web console must be installed and accessible.

    For details, see these topics: Install and Enable Cockpit and Log in to the Cockpit Web Console.

  • The Podman container tools must be installed on the host system. For information on how to install Podman, see Installing Podman and Related Utilities in Oracle Linux: Podman User's Guide.
  • The Cockpit-Podman add-on application must be installed. For further information on how to configure the Cockpit web console to interact with Podman, see Install and Configure Cockpit-Podman.
  • One or more registry images must exist in the Image table to create a container from an Image. For details on how to search and download registry images, see Search and Download New Images.
  • One or more pod groups must exist in the Container table to create a container inside a pod group. For instructions on how to create a pod group, see Create a Pod Group.

Steps

Using the Cockpit web console, follow these steps to create or create and run a container.

  1. In the Cockpit navigation pane, click Podman.

    The Podman page appears.

  2. In the Podman page, perform one of the following:
    • Create a container from an image in the Image table: Navigate to the Image table, find the row with the image that you want to use to create a container, and then in that table row, click Create Container.

      The Create Container dialog appears.

    • Create a container from the Container table: Navigate to the Container table and click Create Container.

      The Create container dialog appears.

    • Create a container in a pod group. Navigate to the Container table, find the row with the pod group that you want to add a container, and then in that table row click Create a container in pod.

      Note:

      The options to Create a container in a pod group only appear when one or more pod groups exist. For information on how to create a pod group, see Create a Pod Group

      The Create container in [pod name group] appears.

  3. In the Create container dialog, perform the following
    1. Specify the applicable properties:
      Name By default, a system generated container name appears in the Name text box. Choose to keep this name or remove it and specify a new name.
      Details tab property: Owner The following Owner options appear only for users with administrator or root privileges.
      • System: Select to create a system ownership pod group.
      • Username (logged in user): Select to create a local user ownership pod group.

      Note:

      The local user ownership pod group is created by default for Cockpit users with limited access privileges. For more information about running pods or containers as a non-root user, see Special Considerations for Non Administrator Containers.
      Details tab property: Image Use the Image list box to specify a registry image for the container.

      For example:

      If the Create container dialog is created from an image in the Image table, the name of the image automatically appears in the Image list.

      If an image isn't already specified, perform the following to specify a registry image.
      • Click the Image list box and select an image saved to cache.

        -or-

      • Type a search string in the Image drop down list box and then select one of the following search criteria: All, Local, Oracle Linux, or Docker.

        In the search results select the appropriate registry image.

      Details tab property: Command Use the Command text box to specify the applicable command to run the container image.

      By default, the run command appears. If required, you can change the command.

      Select the option With Terminal to run the container in a terminal.

      Details tab: Memory limit Use the Memory limit controls to specify the minimum memory allocated to run the container.

      Optional:

      Select the Memory limit checkbox and then using the controls specify a minimum memory allocation value.

      Details tab: CPU Shares

      Note:

      The CPU Shares property applies only to System container configurations.

      CPU shares decide the priority for running containers by the amount of CPU shares allocated to the container. Default value: 1024

      Optional:

      Select the CPU Shares checkbox and then using the controls specify a CPU shares allocation value.

         
      Details tab: Restart Policy

      Note:

      The Restart Policy property applies only to System container configurations.
      Select one of the following:
      • No (default value): No action.
      • On Failure: Restarts a container on failure.
      • Always: Restarts container when exits or after system boot.
      Integration tab: Port Mapping Use the Port Mapping properties to set port mappings between the container and host system. Specifying port mapping exposes services running inside a host container.
      To set port mappings, do the following:
      1. Click Add Port Mapping. The Add Port Mapping dialog appears.
      2. Enter an IP address, host name, and container port.
      3. Select a Protocol from the list.

      For more information about configuring Port Mappings, see Configuring Port Mappings for Containers in Oracle Linux: Podman User's Guide.

      Integration tab property: Volumes Use the Volume properties to share file system space on host system with container.
      To configure the storage volume properties, do the following:
      1. Click Add Volumes. The Add Volumes dialog appears.
      2. Enter a host path and container path.
      3. (Optional) Select the Writable checkbox to create a writable volume.
      4. In the SELinux drop down list, select one of the following options: No Label, Shared, or Private.

      For more information about configuring SELinux with Podman, see Setting SELinux permission in Containers in Oracle Linux: Podman User's Guide.

      Integration tab: Environment variables Use the Environment variable properties for when you want to start a process inside the container.

      To add variables, click Add Variables, and then enter a key and value.

      For more information about the use of environment variables for container processes, see the Environment variables section in the Podman man-page.

      Health check tab: Use the Health properties to help monitor the health or readiness of a process running in a container.
      To run the healthcheck command do the following:
      1. In the Command text box, enter the command that's run in the container to decide the health of a container. The command is the value that you might specify when you run a container with the --healthcheck-command option with the podman create or podman run commands.
      2. Set the following health check properties: Interval (30 second default), Timeout (30 second default), Start period, and Retries (3 default).

        Click the question mark icon next to the health check property to view the usage details.

        For more information about setting container health properties, see the podman-run(1) and podman-healthcheck-run(1) manual pages.

      When health checks fail, Cockpit-Podman can optionally restart, stop, or force stop a container. To set a custom health check action, follow these steps:

      Note:

      To configure the custom health check actions, the latest version of Cockpit-Podman must be installed.
      1. In the When unhealthy property section, click one of the following actions:
        • No Action.
        • Restart
        • Stop
        • Force Stop
      2. Click the question mark icon next to the When unhealthy property to view usage details of each action.

    2. Click one of the following options:
      • Create and Run. The Create and Run option creates the container, starts the container image, and lists the active container in the Container table as Running.
      • Create. The Create option creates the container and lists the container in the Container table as Created.

        Note:

        You can later run a created container from the Container table by selecting Start from the actions [] menu.