guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Provide an option to specify the tmpfs size of the container


From: Ludovic Courtès
Subject: Re: Provide an option to specify the tmpfs size of the container
Date: Thu, 21 Jan 2021 12:02:45 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi,

"Robert Smith" <robertsmith@posteo.net> skribis:

> On Mon Dec 14, 2020 at 10:56 AM Ludovic Courtès wrote:
>> Hi,
>> 
>> luhux <luhux@outlook.com> skribis:
>> 
>> > I am using guix environment --container to containerize my programming 
>> > environment and runtime environment, but I found that the container / 
>> > created by this command uses tmpfs and cannot be resized.
>> >
>> > When a file in the container outputs a lot of logs to the tmpfs of the 
>> > container, the memory usage of the host will be very high (this is usually 
>> > something I did not expect)
>> >
>> > So can provide an option to specify the size of tmpfs?
>> 
>> Sure, why not.  Would you like to give it a try?
>
> This feature caught my interest and I wanted to investigate a bit :)
> tmpfs defaults to half of the available RAM, with the 'size=' option to
> the mount command we can increase this limit but I believe that the
> upper bound is the sum of the available RAM + swap space.

OK.

> Would it be worthwhile to allow for the container filesystem to be
> stored in a non-temporary filesystem, for example allowing the user to
> specify the parent directory of the container root? This would let the
> container fs grow as large as the computer storage allows.

Yes.  This happens in ‘mount-file-systems’ in (gnu build
linux-container):

  ;; The container's file system is completely ephemeral, sans directories
  ;; bind-mounted from the host.
  (mount "none" root "tmpfs")

So we can change it and make sure the temporary root directory is
cleaned up afterwards.  The only use case where this might be useful is
log files, as luhux reported, since in cases where you want to preserve
data, you’d use ‘--share’ instead.

The downside of not using a tmpfs is that data written to the file
system is visible outside the container, in /tmp/guix-directory.XXX,
though that directory is 700.

Thanks,
Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]