Add a default /etc/passwd with a root user. - #14
Conversation
|
Also, what should we put in for the final field, which is the default shell for the user? |
|
I have an idea :) What if we made the We wouldn't be able to append to it, but there likely shouldn't be multiple users available anyhow. |
Good point re no multiple users. We probably want one to exist for root by default. |
|
@dlorenc Agreed. Wouldn't it be awesome if all it took was |
Actually I'm not sure this would work that well without changes to the user directive. This file needs to map the UID to the name in the USER directive. Without knowing the UID the user wants, USER isn't very helpful and we wouldn't be able to auto-create this file. What do you think of another rule to generate this file? Something like: Then you could include this via a normal docker_build rule? |
|
I like @dlorenc's syntax but leaving the buildroot syntax here for reference, which is very similar Docs: |
|
Yeah this is starting to feel a bit overengineered given that I can't imagine a use case of an image needing more than one user. The nice thing about making this into a rule is that we could automate the group creation as well I guess. |
|
I think that (as you suggest) creating the rule provides an element of encapsulation that could enable us to grow what it can do without crazy changes to the If what we're walking about is the creation of a single user, then I'd suggest naming the elements and shedding the This probably belongs in |
|
Another point on encapsulation, if it produces a tarball instead of a single file, then we would accomplish two things:
|
This adds a default /etc/passwd for a root user.
Without this, a simple Go program to find the current user fails:
with:
With this, the program runs correctly:
USER: &{0 0 root root /root}We might also want to create the /root directory.