Podman: Difference between revisions

Marie (talk | contribs)
Add podman group = root security warning
Updated podman compose documentation. I essentially copied the official documentation from https://docs.podman.io/en/stable/markdown/podman-compose.1.html and modified the instructions to use nixos options instead of manual file edits.
 
Line 23: Line 23:
== Tips and tricks ==
== Tips and tricks ==


=== podman-compose ===
=== '''podman compose''' ===
<code>podman-compose</code> is a drop-in replacement for <code>docker-compose</code>
podman compose is a thin wrapper around an external compose provider such as [https://github.com/docker/compose docker-compose] or [https://github.com/containers/podman-compose podman-compose].  This means that <code>podman compose</code> is executing another tool that implements the compose functionality but sets up the environment in a way to let the compose provider communicate transparently with the local Podman socket.  The specified options as well as the command and argument are passed directly to the compose provider.


See [https://docs.podman.io/en/stable/markdown/podman-compose.1.html the official documentation]
The default compose providers are <code>docker-compose</code> and <code>podman-compose</code>.  If installed, <code>docker-compose</code> takes precedence since it is the original implementation of the Compose specification.
 
To change the default behavior or have a custom installation path for your provider of choice: <syntaxhighlight lang="nix">{
  services.podman.settings.containers = { compose_providers = ["/path/to/provider"] };
}</syntaxhighlight>You may also set the <code>PODMAN_COMPOSE_PROVIDER</code> environment variable:<syntaxhighlight lang="bash">PODMAN_COMPOSE_PROVIDER="/path/to/provider" podman compose up -d</syntaxhighlight>or:<syntaxhighlight lang="nix">{
  environment.sessionVariables = {
    PODMAN_COMPOSE_PROVIDER = "/path/to/provider";
  };
}</syntaxhighlight>By default, <code>podman compose</code> will emit a warning saying that it executes an external command. This warning can be disabled by setting <code>compose_warning_logs</code> to false in <code>services.podman.settings.containers</code> or setting the <code>PODMAN_COMPOSE_WARNING_LOGS</code> environment variable to false.<syntaxhighlight lang="nix">{
  services.podman.settings.containers = {
    compose_providers = ["/path/to/provider"];
    compose_warning_logs = false;
  };
}</syntaxhighlight><syntaxhighlight lang="nix">
{
  environment.sessionVariables = {
    PODMAN_COMPOSE_PROVIDER = "/path/to/provider";
    PODMAN_COMPOSE_WARNING_LOGS = false;
  };
}
</syntaxhighlight>


=== With ZFS ===
=== With ZFS ===