1 |
Hey Rich, |
2 |
|
3 |
nice idea, but unfortunately this provides the hostname of the container |
4 |
itself. |
5 |
|
6 |
$ docker run -ti -v /proc/sys/kernel/hostname:/etc/docker-hostname:ro nginx bash |
7 |
root@bea048d42fc3:/# cat /etc/docker-hostname |
8 |
bea048d42fc3 |
9 |
root@bea048d42fc3:/# |
10 |
|
11 |
Without digging deep into it I reckon that the proc (and the sys) |
12 |
filesystems are treated differently, to be sure that each container is in a |
13 |
distinct /proc filesystem. |
14 |
|
15 |
Cheers Christian |
16 |
|
17 |
|
18 |
|
19 |
|
20 |
On 23 August 2016 at 12:01:49, Rich Freeman (rich0@g.o) wrote: |
21 |
|
22 |
On Tue, Aug 23, 2016 at 2:39 AM, Daniel Campbell <zlg@g.o> wrote: |
23 |
> |
24 |
> It makes a bit more sense to rely on previous configuration |
25 |
> (/etc/conf.d/hostname) and write a tiny 'script' that populates |
26 |
> /etc/hostname. bash could do it (naively) in two lines: |
27 |
> |
28 |
> source /etc/conf.d/hostname |
29 |
> echo "$hostname" > /etc/hostname |
30 |
> |
31 |
|
32 |
Seems to me that symlinking /proc/sys/kernel/hostname would be |
33 |
simpler. Also, more reliable, because there are other ways the |
34 |
hostname could be set other than from /etc/conf.d/hostname. The |
35 |
hostname can also change. |
36 |
|
37 |
-- |
38 |
Rich |