Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

podlet

> 编程语言
Open source

Generate Podman Quadlet files from a Podman command, compose file, or existing object

1.6K stars0 likes0 views
WebsiteGitHub

About

Generate Podman Quadlet files from a Podman command, compose file, or existing object

Podlet

Podlet generates Podman Quadlet files from a Podman command, compose file, or existing object. Demo created with Autocast. You can also view the demo on asciinema.

Features

  • Supports the following Podman commands:
    • podman run
    • podman pod create
    • podman kube play
    • podman network create
    • podman volume create
    • podman build
    • podman image pull
    • podman artifact pull
  • Convert a (docker) compose file to:
    • Multiple Quadlet .container files.
    • A Quadlet .pod file and .container files.
    • A Quadlet .kube file and Kubernetes Pod YAML.
    • A .quadlets file for use with podman quadlet install.
  • Generate from existing:
    • Containers
    • Pods
    • Networks
    • Volumes
    • Images
  • Write to stdout or to a file.
  • Options for including common systemd unit options.
  • Checks for existing systemd services to avoid conflict.
    • Opt-out with --skip-services-check.
  • Set Podman version compatibility with --podman-version.
  • Resolve relative host paths with --absolute-host-paths.

Communication

The Podlet project shares communication channels with other projects in the Containers organization. On the Podman Discord, there are two dedicated channels for Podlet:

  • #podlet for user discussions.
  • #podlet-dev for development of Podlet.

For discussions about issues, bugs, or features, feel free to create an issue, discussion, or pull request on GitHub.

Install

Podlet can be acquired in several ways:

  • Download a prebuilt binary from releases.
  • As a container: podman run ghcr.io/containers/podlet.
  • Use cargo-binstall to get a prebuilt binary: cargo binstall podlet.
  • Build and install with cargo install podlet.
  • From your package manager
    • homebrew: brew install podlet

Usage

…

See podlet --help for more information.

Podman Command

…

To generate a Quadlet file, just put podlet in front of your Podman command!

$ podlet podman run quay.io/podman/hello

# FileName=hello
[Container]
Image=quay.io/podman/hello

This is useful for more complicated commands you are copying. For example, let's create a Quadlet file for running Caddy. We'll also use a few options for additional sections in the file.

$ podlet --file . --install --description Caddy \
  podman run \
  --restart always \
  -p 8000:80 \
  -p 8443:443 \
  -v ./Caddyfile:/etc/caddy/Caddyfile:Z \
  -v caddy_data:/data \
  docker.io/library/caddy:latest

Wrote to file: ./caddy.container

$ cat caddy.container

[Unit]
Description=Caddy

[Container]
Image=docker.io/library/caddy:latest
PublishPort=8000:80
PublishPort=8443:443
Volume=./Caddyfile:/etc/caddy/Caddyfile:Z
Volume=caddy_data:/data

[Service]
Restart=always

[Install]
WantedBy=default.target

The name for the file was automatically pulled from the image name, but can be overridden with the --name option.

Podlet also supports creating .pod, .kube, .network, .volume, .build, .image, and .artifact Quadlet files.

$ podlet podman kube play --network pasta --userns auto caddy.yaml

# FileName=caddy
[Kube]
Yaml=caddy.yaml
Network=pasta
UserNS=auto

Global Podman options are added to the GlobalArgs= Quadlet option.

Compose

$ podlet compose -h

Generate Podman Quadlet files from a compose file

Usage: podlet compose [OPTIONS] [COMPOSE_FILE]

Arguments:
  [COMPOSE_FILE]  The compose file to convert

Options:
      --pod   Create a `.pod` file and link it with each `.container` file
      --kube  Create a Kubernetes YAML file for a pod instead of separate containers
  -h, --help  Print help (see more with '--help')

Let's return to the Caddy example, say you have a compose file at compose-example.yaml:

name: caddy
services:
  caddy:
    image: docker.io/library/caddy:latest
    ports:
      - 8000:80
      - 8443:443
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:Z
      - caddy-data:/data
volumes:
  caddy-data:

podlet compose compose-example.yaml will create a caddy.container file like so:

# FileName=caddy
[Container]
Image=docker.io/library/caddy:latest
PublishPort=8000:80
PublishPort=8443:443
Volume=./Caddyfile:/etc/caddy/Caddyfile:Z
Volume=caddy-data:/data

If a compose file is not given, Podlet will search for the following files in the current working directory, in order:

  • compose.yaml
  • compose.yml
  • docker-compose.yaml
  • docker-compose.yml
  • podman-compose.yaml
  • podman-compose.yml

Pod

The --pod option will create a .pod Quadlet file and link each .container file to it.

$ podlet compose --pod compose-example.yaml

# FileName=caddy-caddy
[Container]
Image=docker.io/library/caddy:latest
Pod=caddy.pod
Volume=./Caddyfile:/etc/caddy/Caddyfile:Z
Volume=caddy-data:/data

---

# FileName=caddy
[Pod]
PublishPort=8000:80
PublishPort=8443:443

Kubernetes YAML

The --kube option will generate Kubernetes YAML which groups all compose services in a pod.

…

Notes

When converting Compose files, not all options are supported by Podman/Quadlet. This is especially true when converting to Kubernetes YAML as some options must be applied to the pod as a whole. If Podlet encounters an unsupported option an error will be returned. You will have to remove or comment out unsupported options to proceed.

Podlet does not yet support Compose interpolation.

See podlet compose --help for more information.

Generate from Existing

$ podlet generate -h

Generate a Podman Quadlet file from an existing object

Usage: podlet generate <COMMAND>

Commands:
  container  Generate a Quadlet file from an existing container
  pod        Generate Quadlet files from an existing pod and its containers
  network    Generate a Quadlet file from an existing network
  volume     Generate a Quadlet file from an existing volume
  image      Generate a Quadlet file from an image in local storage
  help       Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help (see more with '--help')

If you have an existing container, pod, network, volume, or image, you can use podlet generate to create a Quadlet file from it.

$ podman container create --name hello quay.io/podman/hello:latest

$ podlet generate container hello

# FileName=hello
[Container]
ContainerName=hello
Image=quay.io/podman/hello:latest

These commands require that podman is installed and searchable from the PATH environment variable.

See podlet generate --help for more information.

In a Container

While Podlet can be used as-is in a container, passing the command to it; if you want to utilize some of the write-to-file functionality, or create Quadlet files from compose files, additional volumes may need to be attached.

An example of a generic Podman command that runs the most up-to-date version of Podlet with the current directory and user's Quadlet directory attached to the container would be:

podman run --rm --userns keep-id -e HOME -e XDG_CONFIG_HOME --user $(id -u) -v "$PWD":"$PWD" -v "$HOME/.config/containers/systemd/":"$HOME/.config/containers/systemd/" -w "$PWD" --security-opt label=disable --pull=newer ghcr.io/containers/podlet

Please note that --security-opt label=disable may be required for systems with SELinux. If your system does not use SELinux, the option is not needed. Podman recommends disabling SELinux separation when mounting system files and directories to containers. See the note at the end of the "Labeling Volume Mounts" section in the podman run --volume documentation.

Alternatively, if you just want Podlet to read a specific compose file you can use:

podman run --rm -v ./compose.yaml:/compose.yaml:Z ghcr.io/containers/podlet compose /compose.yaml

Cautions

Podlet is primarily a tool for helping to get started with Podman systemd units, aka Quadlet files. It is not meant to be an end-all solution for creating and maintaining Quadlet files. Files created with Podlet should always be reviewed before starting the unit.

Podlet is not (yet) a validator for Podman commands. Some Podman options are incompatible with each other and most options require specific formatting and/or only accept certain values. However, a few options are fully parsed and validated in order to facilitate creating the Quadlet file.

Contribution

Contributions, suggestions, and/or comments are appreciated! See the contribution guide for more information on reporting issues, submitting pull requests, building Podlet, the Minimum Supported Rust Version (MSRV) policy, and running CI tasks locally.

License

All source code for Podlet is licensed under the Mozilla Public License v2.0. View the LICENSE file for more information.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustcontainerspodmanquadletrust

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言