1 |
On Tue, Dec 10, 2019 at 7:26 AM Thomas Deutschmann <whissi@g.o> wrote: |
2 |
> |
3 |
> On 2019-12-10 12:47, Rich Freeman wrote: |
4 |
> > Having UIDs chosen completely at random seems fairly non-optimal. |
5 |
> > Suppose you're building containers/etc and then bind-mounting in |
6 |
> > persistent storage (/var/lib/mysql and so on). Wouldn't it be nice if |
7 |
> > the default were that mysql would get the same UID on every build? I |
8 |
> > guess you could provide an initial /etc/passwd on every fresh build |
9 |
> > but it just seems like an extra step. |
10 |
> |
11 |
> In practice you will *never* assume proper container <> host user |
12 |
> mapping. *Never*. If you do that, you are doing it wrong: |
13 |
|
14 |
I'm not talking about container-host mapping. I'm talking about |
15 |
building the same container 100 times and having the container end up |
16 |
with the same UIDs inside each time. |
17 |
|
18 |
Build order in portage isn't really deterministic, especially over |
19 |
long periods of time, so you can't rely on stuff getting installed in |
20 |
the same order. |
21 |
|
22 |
> - Container sometimes switch base images. You won't notice that unless |
23 |
> you follow container provider very closely. But you are using container |
24 |
> because you are focused on containerized application, not the container |
25 |
> itself... |
26 |
|
27 |
I'm talking about Gentoo containers here that YOU are the one |
28 |
building. Not just doing "docker run foo." Obviously if you're using |
29 |
somebody else's images you're going to end up with whatever UIDs they |
30 |
use. Chances are they're from some distro that actually DOES manage |
31 |
their UIDs so they'll still be stable over time unless the base image |
32 |
changes as you say. |
33 |
|
34 |
> - Your host is maybe running some real services. You really don't want |
35 |
> that a container suddenly become able to access these services just |
36 |
> because container <> host mapping has match. |
37 |
|
38 |
Uh, the container processes shouldn't even see the host |
39 |
processes/files whether they have the same UIDs or not... |
40 |
|
41 |
-- |
42 |
Rich |