Re: Detecting if you are running in a container

From: Eric W. Biederman
Date: Wed Oct 19 2011 - 17:36:29 EST


"H. Peter Anvin" <hpa@xxxxxxxxx> writes:

> On 10/14/2011 11:04 AM, Eric W. Biederman wrote:
>>
>> I have found and merged a solution that allows us to name namespaces
>> without needing a namespaces for namespaces.
>>
>
> Something based on UUIDs, perhaps?
>
> UUIDs are kind of exactly this, after all... a single namespace designed
> to be large and random enough to be globally unique without a central
> registration authority.

mount --bind /proc/self/ns/net /var/run/netns/<name>

When we want to refer to the namespace in syscalls we pass a file
descriptor we received from opening the namespace reference object.

That moves the entire naming problem into the file namespace.

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/