Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/virtualisation.podman: Init module #85604

Merged
merged 4 commits into from Apr 21, 2020

Conversation

adisbladis
Copy link
Member

@adisbladis adisbladis commented Apr 20, 2020

Motivation for this change

This is another stab at making a module for podman, a drop-in replacement for Docker.

Unlike previous attempts ( #68343 & #54925 ) this tries to stay very close to upstream defaults and introduce minimal configuration.

I also have tests and release notes.
I have been running a very similar module in my own configuration for quite some time without issues.
It works just fine rootless too with the following configuration in configuration.nix:

virtualisation.podman.enable = true;
virtualisation.podman.dockerCompat = true;
virtualisation.containers.users = [ "adisbladis" "aoeu" ];

Should we add a config option to set up subuid/subgid ranges for users in the podman module maybe? - done

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

cc @vdemeester @peterhoeg @nlewo

Closes #65202

nixos/modules/virtualisation/podman.nix Show resolved Hide resolved
nixos/modules/virtualisation/podman.nix Outdated Show resolved Hide resolved
nixos/modules/virtualisation/podman.nix Outdated Show resolved Hide resolved
@peterhoeg
Copy link
Member

This is nice and much nicer than mine (a lot less code which is great!).

Should we add a config option to set up subuid/subgid ranges for users in the podman module maybe?

Yes please.

@vdemeester vdemeester mentioned this pull request Apr 20, 2020
10 tasks
@adisbladis
Copy link
Member Author

Should we add a config option to set up subuid/subgid ranges for users in the podman module maybe?
Yes please.

Can you think of a nice interface for this?

@adisbladis adisbladis force-pushed the podman-module branch 2 times, most recently from 0696da8 to 632df11 Compare April 20, 2020 10:55
@adisbladis
Copy link
Member Author

I've opted to make subuid/subgid users a simple list:

    virtualisation.podman.users = [
      "adisbladis"
    ];

@zowoq
Copy link
Contributor

zowoq commented Apr 20, 2020

podman and related packages have a team if you want to add it as a maintainer for the module.

cc @saschagrunert

@adisbladis
Copy link
Member Author

I've also moved declarative docker containers to podman in https://github.com/adisbladis/nixpkgs/tree/podman-declarative-containers. This will be a follow-up PR.

@adisbladis
Copy link
Member Author

podman and related packages have a team if you want to add it as a maintainer for the module.

Done! also added myself to the podman team.

@adisbladis
Copy link
Member Author

@GrahamcOfBorg eval
@GrahamcOfBorg test podman

@adisbladis
Copy link
Member Author

Unless I get some very strong objections my plan is to move fast on this and merge soon.

@buckley310
Copy link
Contributor

Is it a good idea to map all podman users to the same 100000+65536 range?

Copy link
Contributor

@zowoq zowoq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this!

Tested, works well. Looks great, just a couple of nits.

maintainers/team-list.nix Show resolved Hide resolved
nixos/modules/virtualisation/podman.nix Outdated Show resolved Hide resolved
nixos/tests/podman.nix Outdated Show resolved Hide resolved
nixos/modules/virtualisation/podman.nix Outdated Show resolved Hide resolved
@adisbladis adisbladis force-pushed the podman-module branch 2 times, most recently from e67bd4b to e437fb9 Compare April 20, 2020 22:45
@adisbladis
Copy link
Member Author

Is it a good idea to map all podman users to the same 100000+65536 range?

No that was an oversight. I've fixed this.

@adisbladis
Copy link
Member Author

I have created a new virtualisation.containers module.
The cri-o module was also creating /etc/containers/policy.json so these modules would be mutually exclusive.
With this change things composes much better with multiple container runtimes.
This leads to a much smaller podman module with a better defined scope.

@adisbladis adisbladis force-pushed the podman-module branch 2 times, most recently from a45cfd5 to 3e5f2e7 Compare April 21, 2020 09:33
In anticipation of the new containers module.
…ation module

What's happening now is that both cri-o and podman are creating
/etc/containers/policy.json.

By splitting out the creation of configuration files we can make the
podman module leaner & compose better with other container software.
@adisbladis
Copy link
Member Author

@GrahamcOfBorg test podman

Copy link
Contributor

@talyz talyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good! The only issue I experienced was this message:

ERRO[0520] unable to close namespace: "close /proc/335/ns/user: bad file descriptor"

when exiting a container, seemingly at random. This might just be a podman bug and it doesn't seem to cause any problems.

@adisbladis
Copy link
Member Author

@talyz That looks to be containers/podman#5873.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/podman-and-docker-fail-to-mount/11709/3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman doesn't work well
8 participants