Skip to main content

org.osbuild.containers.unit.create

Create a podman systemd unit file

This stage allows to create Podman systemd (quadlet) unit files. The filename property specifies the, '.service' or '.mount' file to be added. These names are validated using the, same rules as specified by podman-systemd.unit(5) and they must contain the, '.container', '.volume' or '.network' suffix (other types of unit files are not supported). 'unit-path' determines determine the unit load path.

The Unit configuration can currently specify the following subset of options:

  • 'Unit' section
    • 'Description' - string
    • 'ConditionPathExists' - string
    • 'ConditionPathIsDirectory' - string
    • 'DefaultDependencies' - bool
    • 'Requires' - [strings]
    • 'Wants' - [strings]
    • 'After' - [strings]
    • 'Before' - [strings]
  • 'Service' section
    • 'Restart' - string
  • 'Container' section
    • 'Image' - string
    • 'Exec' - string
    • 'Volume' - [string]
    • 'User' - string
    • 'Group' - string
    • 'AddDevice' - string
    • 'Environment' - [object]
    • 'Network' - string
    • 'WorkingDir' - string
  • 'Volume' section
    • 'VolumeName' - string
    • 'Driver' - string
    • 'Image' - string
    • 'User' - string
    • 'Group' - string
  • 'Network' section
    • 'Gateway' - string
    • 'DNS' - string
    • 'IPRange' - string
    • 'Subnet' - string
    • 'Driver' - string
    • 'NetworkName' - string
  • 'Install' section
    • 'WantedBy' - [string]
    • 'RequiredBy' - [string]

Schema 1

{
"additionalProperties": false,
"required": [
"filename",
"config"
],
"properties": {
"filename": {
"type": "string",
"pattern": "^[\\w:.\\\\-]+[@]{0,1}[\\w:.\\\\-]*\\.(container|volume|network)$"
},
"unit-path": {
"type": "string",
"enum": [
"usr",
"etc"
],
"default": "usr",
"description": "Define the system load path"
},
"config": {
"additionalProperties": false,
"type": "object",
"oneOf": [
{
"required": [
"Unit",
"Container",
"Install"
],
"not": {
"anyOf": [
{
"required": [
"Volume"
]
},
{
"required": [
"Network"
]
}
]
}
},
{
"required": [
"Volume"
],
"not": {
"anyOf": [
{
"required": [
"Container"
]
},
{
"required": [
"Network"
]
}
]
}
},
{
"required": [
"Network"
],
"not": {
"anyOf": [
{
"required": [
"Container"
]
},
{
"required": [
"Volume"
]
}
]
}
}
],
"description": "Configuration for a '.container' unit.",
"properties": {
"Unit": {
"additionalProperties": false,
"type": "object",
"description": "'Unit' configuration section of a unit file.",
"properties": {
"Description": {
"type": "string"
},
"Wants": {
"type": "array",
"items": {
"type": "string"
}
},
"After": {
"type": "array",
"items": {
"type": "string"
}
},
"Before": {
"type": "array",
"items": {
"type": "string"
}
},
"Requires": {
"type": "array",
"items": {
"type": "string"
}
},
"ConditionPathExists": {
"type": "array",
"items": {
"type": "string"
}
},
"ConditionPathIsDirectory": {
"type": "array",
"items": {
"type": "string"
}
},
"DefaultDependencies": {
"type": "boolean"
}
}
},
"Service": {
"additionalProperties": false,
"type": "object",
"description": "'Service' configuration section of a unit file.",
"properties": {
"Restart": {
"type": "string",
"enum": [
"no",
"on-success",
"on-failure",
"on-abnormal",
"on-watchdog",
"on-abort",
"always"
]
}
}
},
"Container": {
"additionalProperties": false,
"type": "object",
"description": "'Container' configuration section of a unit file.",
"required": [
"Image"
],
"properties": {
"Environment": {
"type": "array",
"description": "Sets environment variables for executed process.",
"items": {
"type": "object",
"description": "Sets environment variables for executed process.",
"additionalProperties": false,
"properties": {
"key": {
"type": "string",
"pattern": "^[A-Za-z_][A-Za-z0-9_]*"
},
"value": {
"type": "string"
}
}
}
},
"Image": {
"description": "Container Image to use",
"type": "string"
},
"Exec": {
"description": "Command to execute in container",
"type": "string"
},
"Volume": {
"description": "Volumes to use",
"type": "array",
"items": {
"type": "string"
}
},
"User": {
"description": "Run as user",
"type": "string"
},
"Group": {
"description": "Run as group",
"type": "string"
},
"AddDevice": {
"description": "Add device to container",
"type": "string"
},
"Network": {
"description": "What network option to use",
"type": "string"
},
"WorkingDir": {
"description": "Working directory for initial process",
"type": "string"
}
}
},
"Volume": {
"additionalProperties": false,
"type": "object",
"description": "'Volume' configuration section of a unit file.",
"properties": {
"VolumeName": {
"description": "Override volume name",
"type": "string"
},
"Driver": {
"description": "What volume driver to use",
"type": "string"
},
"Image": {
"description": "Image to use if driver is image",
"type": "string"
},
"User": {
"description": "User to use as owner of the volume",
"type": "string"
},
"Group": {
"description": "Group to use as owner of the volume",
"type": "string"
}
}
},
"Network": {
"additionalProperties": false,
"type": "object",
"description": "'Network' configuration section of a unit file.",
"properties": {
"Gateway": {
"description": "Addres of gaterway",
"type": "boolean"
},
"DNS": {
"description": "Address of DNS server",
"type": "boolean"
},
"IPRange": {
"description": "Range to allocate IPs from",
"type": "boolean"
},
"Subnet": {
"description": "Subnet in CIDR notation",
"type": "boolean"
},
"Driver": {
"description": "What network driver to use",
"type": "boolean"
},
"NetworkName": {
"description": "Override network name",
"type": "boolean"
}
}
},
"Install": {
"additionalProperties": false,
"type": "object",
"description": "'Install' configuration section of a unit file.",
"properties": {
"WantedBy": {
"type": "array",
"items": {
"type": "string"
}
},
"RequiredBy": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}

Schema 2

{}