How to use the Podman plugin
This topic provides information on how to use the Podman plugin.
Deploy a podman Container
- Create an application and a deployment package.
- Hover over the deployment package, click > New, and then select
podman.ContainerSpec
. - Hover over the deployment package containing the new
podman.ContainerSpec
, click > Deploy, and select the target environment. - Click Continue and then click Deploy to execute the plan.
Sample Manifest
<?xml version="1.0" encoding="UTF-8"?>
<udm.DeploymentPackage version="demo_podman_host" application="demo_create_container_app">
<application />
<orchestrator />
<deployables>
<podman.ContainerSpec name="/nginx_container">
<tags />
<containerName>demo_nginx</containerName>
<image>nginx</image>
<labels />
<environment />
<restartPolicyMaximumRetryCount>40</restartPolicyMaximumRetryCount>
<networks />
<dnsOptions />
<links />
<portBindings />
<volumeBindings />
</podman.ContainerSpec>
</deployables>
<applicationDependencies />
<dependencyResolution>LATEST</dependencyResolution>
<undeployDependencies>false</undeployDependencies>
</udm.DeploymentPackage>
Deploy a podman Pod
- Create an application and a deployment package.
- Hover over the deployment package, click > New, and then select
podman.Service
. - Hover over the deployment package containing the new
podman.Pod
, click > Deploy. - Click Continue and then click Deploy to execute the plan.
Sample Manifest
<?xml version="1.0" encoding="UTF-8"?>
<udm.DeploymentPackage version="podman_pod" application="podman_pod_demo_app">
<application />
<orchestrator />
<deployables>
<podman.PodSpec name="/tomcat_service">
<cgroup_parent />
<name>tomcat-service</name>
<infra_image>tomcat</infra_image>
<labels />
<hostname />
<cpu_period>1</cpu_period>
<cpu_quota>1</cpu_quota>
<infra_command />
<no_infra />
<no_manage_hosts />
<pod_create_command />
<pod_devices />
</podman.PodSpec>
</deployables>
<applicationDependencies />
<dependencyResolution>LATEST</dependencyResolution>
<undeployDependencies>false</undeployDependencies>
</udm.DeploymentPackage>
Note: You can deploy a podman Pod.
Deploy a Podman Volume
Create an independent volume
- Create an application and a deployment package.
- Hover over the deployment package, click > New, and then select
podman.VolumeSpec
. - Enter a name for the service in the Name field and specify a Volume Name for the volume.
- Hover over the deployment package containing the new
podman.VolumeSpec
, click > Deploy and select the target environment. - Click Continue and then click Deploy to execute the plan.
- To check if the volume is created, run this command:
podman volume ls
Attach a volume to a Podman container
- Hover over the created container, click > New, and then select MountedVolumeSpec.
- Enter a name for the application version, specify a name for the volume, enter the directory of the Podman container where the volume will be attached in the Mountpoint field, and set the default value to false in the Read Only field.
- Deploy the created package to the target environment.
The Podman container is created with the mounted volume attached at the mount point.
Sample Manifest
<?xml version="1.0" encoding="UTF-8"?>
<udm.DeploymentPackage version="podman_volume" application="podman_volume_demo">
<application />
<orchestrator />
<deployables>
<podman.VolumeSpec name="/test_volume">
<tags />
<volumeName>testvolume</volumeName>
<driver>default</driver>
<driverOptions />
<labels />
</podman.VolumeSpec>
<podman.ContainerSpec name="/nginx_container">
<container_name>nginx-container</container_name>
<image>nginx</image>
<labels />
<environment />
<portBindings />
<volumeBindings>
<podman.MountedVolumeSpec name="/nginx_container/testvolume">
<volumeName>testvolume</volumeName>
<mountpoint>/tmp</mountpoint>
</podman.MountedVolumeSpec>
</volumeBindings>
</podman.ContainerSpec>
</deployables>
<applicationDependencies />
<dependencyResolution>LATEST</dependencyResolution>
<undeployDependencies>false</undeployDependencies>
</udm.DeploymentPackage>
Create a Podman Network
- Create an application and a deployment package.
- Hover over the deployment package, click > New, and then select
podman.NetworkSpec
. Perform the same action again to create apodman.ContainerSpec
. - In the Network Name field, specify the name of the private network that will be created.
- Click Save to create the network.
- For the created container, go to the Network tab and add the name of the network, which will bind the
containers. - Deploy the application to the target environment.
- Log in to your Podman host and run this command:
podman network inspect <network_name>
- To verify if the network is created with the Podman host, run this command:
podman network ls
Map a Podman container port to a Podman host
Port mapping is used to map the host port with the container port.
Create a port mapper
- Create a container inside an application with a deployment package.
- Hover over the created container, click > New, and then select PortSpec.
- Enter a name for the application version.
- In the Host Port field, enter the port of the Podman host that will be mapped to the container, the container port, and specify the protocol over which the connection will be established.
- Deploy the application to the target environment.
- Log in to your podman host and run this command:
podman network inspect <network_name>
- To verify if the network is created with the podman host, run this command:
podman network ls
Sample Manifest
<?xml version="1.0" encoding="UTF-8"?>
<udm.DeploymentPackage version="network_package" application="podman_demo_network">
<application />
<orchestrator />
<deployables>
<podman.NetworkSpec name="/custom_network">
<tags />
<networkName>custom_network</networkName>
<networkOptions />
</podman.NetworkSpec>
<podman.ContainerSpec name="/mysql-container">
<tags />
<containerName>mysql-container</containerName>
<image>mysql</image>
<labels />
<environment />
<networks>
<value>custom_network</value>
</networks>
<dnsOptions />
<links />
<portBindings>
<podman.PortSpec name="/mysql-container/port_map">
<hostPort>92</hostPort>
<containerPort>80</containerPort>
<protocol>tcp</protocol>
</podman.PortSpec>
</portBindings>
<volumeBindings />
</podman.ContainerSpec>
</deployables>
<applicationDependencies />
<dependencyResolution>LATEST</dependencyResolution>
<undeployDependencies>false</undeployDependencies>
</udm.DeploymentPackage>