Crates.io | podman-openrc |
lib.rs | podman-openrc |
version | 0.1.3 |
created_at | 2025-07-25 17:32:17.535053+00 |
updated_at | 2025-08-16 18:31:09.346197+00 |
description | A CLI tool to generate OpenRC scripts from Podman service definitions in (unofficial) TOML format. |
homepage | https://git.plabble.org/Maurice/podman-openrc |
repository | https://git.plabble.org/Maurice/podman-openrc |
max_upload_size | |
id | 1767859 |
size | 27,214 |
This is a simple application written in Rust to convert a simple Podman service definition in TOML format to an OpenRC service script.
cargo install podman-openrc
podman-openrc <INPUT TOML FILE> <OUTPUT OPENRC FILE>
# For example: podman-openrc input.toml output.service.sh
The TOML format describing a Podman service is non-standard. It is NOT a Podlet. The format is like this:
user = "<USERNAME>" # Optional property, set if you don't want to run the Podman command with the root user
capabilities = ["NET_BIND_SERVICE"] # Optional property, add Linux capabilities if you need some
# Required section
[service]
name = "<CONTAINER NAME>" # Container name, required
image = "<IMAGE>" # Podman image name
depend = ["<SERVICE NAME>"] # Name of any service in /etc/init.d to depend on
restart = "unless-stopped" # Restart, optional. Defaults to "unless-stopped"
detach = true # Run container in detach mode, optional, default true. Recommended.
hostname = "<HOSTNAME>" # Host name, optional.
command = "<COMMAND>" # Container command to run, optional.
# Optionally set one or more environment variables
[environment]
ASPNETCORE_ENVIRONMENT = "Test"
# If you have a not TOML-compatible key name, use "" around the key name
# Optional, if you want to run the container within specific network(s). Set to "host" if you don't want to use the podman networking.
[[networks]]
name = "host"
# You can also create groups
[[networks]]
name = "netw-service-test"
group = "http-networks"
# And assign ALL networks assigned to a group to a service
[[networks]]
group = "http-networks"
# Optionally, you can assign one or more port mappings
[[ports]]
host = 80 # Port on your computer
container = 8080 # Port inside the container
protocol = "tcp" # Protocol, optional
# Optionally you can also assign volumes
[[volumes]]
source = "<VOLUME NAME>" # Volume name or path on host
target = "<PATH>" # Volume location/target inside container
create = true # Optional, set to true if volume is NOT a path but named volume and you want to create it
# Or you can make more advanced volumes with mounts
[[mounts]]
typ = "bind" # Mount type
source = "/etc/hosts" # Source file
target = "/etc/hosts" # Target file
read_only = true # Whether to use ro mode, optional
# Optionally you can use Podman secrets in an array
[[secrets]]
key = "<SECRET KEY>" # Secret key used in `podman secret`
target = "<TARGET SECRET FILE>" # Target secret filename in /var/run/secrets. Optional, defaults to the key
# Between environment and secrets: get secret from Podman and set it as environment variable
[[environment_secrets]]
name = "<ENV VARIABLE>" # Target environment variable name
secret = "<SECRET NAME>" # Secret key in `podman secret`
# Optionally, you can configure a healthcheck
[service.healthcheck]
cmd = "<HEALTHCHECK COMMAND>" # The command or route to run/check
interval = "5m" # Interval, optional
start_period = "30s" # Start period (start after), optional
retries = 3 # Max retries, optional
on_failure = "none" # On failure options, optional