Podman: Difference between revisions
imported>Chuangzhu Add instructions for using `virtualisation.oci-containers` |
imported>TyberiusPrime No edit summary |
||
Line 22: | Line 22: | ||
https://gist.github.com/adisbladis/187204cb772800489ee3dac4acdd9947 | https://gist.github.com/adisbladis/187204cb772800489ee3dac4acdd9947 | ||
Note that rootless podman requires newuidmap | Note that rootless podman requires newuidmap (from shadow). If you're not on NixOS, this can't not 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 == | == Run Podman containers as systemd services == |
Revision as of 14:52, 25 January 2022
Podman can run rootless containers and be a drop-in replacement for Docker.
Install and configure podman with NixOS service configuration
{ pkgs, ... }:
{
virtualisation = {
podman = {
enable = true;
# Create a `docker` alias for podman, to use it as a drop-in replacement
dockerCompat = true;
};
};
}
Use Podman within nix-shell
https://gist.github.com/adisbladis/187204cb772800489ee3dac4acdd9947
Note that rootless podman requires newuidmap (from shadow). If you're not on NixOS, this can't not be supplied by the Nix package 'shadow' since setuid/setgid programs are not currently supported by Nix.
Run Podman containers as systemd services
{
virtualisation.oci-containers.backend = "podman";
virtualisation.oci-containers.containers = {
container-name = {
image = "container-image";
autoStart = true;
ports = [ "127.0.0.1:1234:1234" ];
};
};
}