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

docker-tools: set user/group when creating a pure layer #27017

Merged
merged 2 commits into from
Jul 15, 2017

Conversation

LnL7
Copy link
Member

@LnL7 LnL7 commented Jul 1, 2017

Motivation for this change

Currently the uid of the build user ends up in the image, this makes the permissions deterministic and configurable.

dockerTools.buildImage {
  name = "foo";
  contents = [ pkgs.busybox ];

  uid = 42;
  extraCommands = ''
    touch foo
  '';
}
docker run --rm -it foo /bin/ls -l foo
# -rw-r--r--    1 42        0                0 Jan  1  1970 foo
Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • Linux
  • 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature. The key has expired.
LnL7 Daiderd Jordan
@mention-bot
Copy link

@LnL7, thanks for your PR! By analyzing the history of the files in this pull request, we identified @adnelson, @lethalman and @timclassic to be potential reviewers.

@@ -297,7 +298,7 @@ rec {
# How much disk to allocate for the temporary virtual machine.
diskSize ? 1024,
# Commands (bash) to run on the layer; these do not require sudo.
extraCommands ? ""
extraCommands ? "", uid ? 0, gid ? 0
Copy link
Member

Choose a reason for hiding this comment

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

Looks like these ones aren't used.

Verified

This commit was signed with the committer’s verified signature. The key has expired.
LnL7 Daiderd Jordan
@LnL7 LnL7 force-pushed the docker-pure-layer branch from 9b6656e to 83fbc0f Compare July 8, 2017 11:57
@LnL7 LnL7 merged commit 90ff6b1 into NixOS:master Jul 15, 2017
@LnL7 LnL7 deleted the docker-pure-layer branch July 18, 2018 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants