Podman: Difference between revisions

Malix (talk | contribs)
general enhancements
m The way to change registries globally caused conflicts and does not work.
 
(One intermediate revision by one other user not shown)
Line 25: Line 25:
See [https://docs.podman.io/en/stable/markdown/podman-compose.1.html the official documentation]
See [https://docs.podman.io/en/stable/markdown/podman-compose.1.html the official documentation]


=== Using podman with ZFS ===
=== With ZFS ===


Rootless can't use [[ZFS]] directly but the overlay needs POSIX ACL enabled for the underlying ZFS filesystem, ie., <code>acltype=posixacl</code>
Rootless can't use [[ZFS]] directly but the overlay needs POSIX ACL enabled for the underlying ZFS filesystem, ie., <code>acltype=posixacl</code>
Line 31: Line 31:
Best to mount a dataset under <code>/var/lib/containers/storage</code> with property <code>acltype=posixacl</code>.
Best to mount a dataset under <code>/var/lib/containers/storage</code> with property <code>acltype=posixacl</code>.


=== Use Podman within nix-shell ===
=== Within nix-shell ===
From https://gist.github.com/adisbladis/187204cb772800489ee3dac4acdd9947 :<blockquote>{{File|3={ pkgs ? import <nixpkgs> {} }:
From https://gist.github.com/adisbladis/187204cb772800489ee3dac4acdd9947 :<blockquote>{{File|3={ pkgs ? import <nixpkgs> {} }:


Line 89: Line 89:
}|name=podman-shell.nix|lang=nix}}</blockquote>Note that rootless podman requires newuidmap (from shadow). If you're not on NixOS, this cannot be supplied by the Nix package 'shadow' since [https://nixos.org/manual/nix/unstable/expressions/derivations.html setuid/setgid programs are not currently supported by Nix].
}|name=podman-shell.nix|lang=nix}}</blockquote>Note that rootless podman requires newuidmap (from shadow). If you're not on NixOS, this cannot be supplied by the Nix package 'shadow' since [https://nixos.org/manual/nix/unstable/expressions/derivations.html setuid/setgid programs are not currently supported by Nix].


=== Run Podman containers as systemd services ===
=== Containers as systemd services ===
<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
{
{
Line 103: Line 103:
</syntaxHighlight>
</syntaxHighlight>


=== Run cross-architecture containers with binfmt/qemu ===
=== Cross-architecture containers using binfmt/qemu ===
<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
boot.binfmt = {
boot.binfmt = {
Line 115: Line 115:
</syntaxhighlight>
</syntaxhighlight>


=== DevContainer ===
=== DevContainers ===
Using Podman, it is possible that the process of creation of DevContainers' containers to become stuck at the "Please select an image URL" step.
Using Podman, it is possible that the process of creation of DevContainers' containers to become stuck at the "Please select an image URL" step.


To avoid this issue, you might restrict its registries configuration.
To avoid this issue, you might restrict its registries configuration.


You can do such using [[Home Manager]] manually:
You can change the global registries with:<syntaxhighlight lang="nix">
virtualisation.containers.registries.search = [ "docker.io" ];
</syntaxhighlight>


{{File|3=# Global `/etc/containers/registries.conf`
For user-scoped registries you can do using [[Home Manager]] manually:
environment.etc."containers/registries.conf".text = ''
  [registries.search]
  registries = ['docker.io']
'';


# User-scoped `~/.config/containers/registries`
{{File|3=# User-scoped `~/.config/containers/registries`
xdg.configFile."containers/registries.conf".text = ''
xdg.configFile."containers/registries.conf".text = ''
   [registries.search]
   [registries.search]