subuser-security / subuser

Run programs on linux with selectively restricted permissions.
http://subuser.org
GNU Lesser General Public License v3.0
890 stars 65 forks source link

ENHANCMENT: save compressed subuser images #50

Open peter1000 opened 10 years ago

peter1000 commented 10 years ago

Before starting with subuser a couple of days ago I looked into saving compressed docker images to file.

Because I like to be as much as possible internet independent (or if one uses subuser with a slower connection on a mobile ect.. or download limit) I will add the option to save subuser program images to file.

build once transfer and install multiple times.

timthelion commented 10 years ago

This is a good idea. I think, going off the example of git, we could call it subuser bundle...

peter1000 commented 10 years ago

Not sure if that would be the best for what I had in mind.

Anyway, I implemented the first part of it to save to file: but will only send a pullrequest after the make image is merged.

at the moment I live in Southamerica so I do not want to be always dependent on the internet even though it works mostly fine

So my idea would be:

Additional folder: savedCompressedProgramImages

subuser save-compressed-image firefox saves to 'subuser/savedCompressedProgramImages/firefox.tar.xz

The compression is quite ok: the new libubuntu_precise has 172.2 MB and compresses to a saved one of 36 MB

This I already finished

peter1000 commented 10 years ago

The second part I will do is a simple: command: install-compressed-image

the third part would be to integrate it into the normal subuser install procedure maybe with an option like

subuser install firefox --allow-saveimage or something like that

Than it should first check if for any required dependency a saved image is available: this should work from top->bottom of dependencies because if a saved image for x11 is ready we do not need the lower dependent once

Just an idea?

peter1000 commented 10 years ago

maybe the list argument could also have an option subuser list savedimage

peter1000 commented 10 years ago

the example: firefox_libx11_libubuntu_precise 373.2 MB compressed to 92 MB

Anyway if we want we could add a compression level option: xz uses default level 6 of 9

peter1000 commented 10 years ago

compression level 9 did reduce a test image another 10+%

libubuntu_precise compression6.tar.xz 36.2MB libubuntu_precise compression9.tar.xz 31.9MB

timthelion commented 10 years ago

I will work on going over all your comments tomorrow. It's 1 am here, and I want to think this through properly...

peter1000 commented 10 years ago

see explanation: https://github.com/subuser-security/subuser/commit/47e364714f51b6c8dd40e5e8b58bfe2cb10aa08e#commitcomment-5405340

timthelion commented 10 years ago

It just occured to me, that putting the image-id into the filename won't work on Windows due to the 255 character long path restriction.

timthelion commented 10 years ago

I think that we shouldn't worry about that though. Some advanced features may not be supported on outdated operating systems ;)

peter1000 commented 10 years ago

Do you want an image file and a extra jsonlike

firefox-image.tar.xz
firefox-image.json

firefox-image.json has the output of inspect

timthelion commented 10 years ago

That would be fine. But don't put the program name in the name of the files. It is simpler to progam if the names are standard.

peter1000 commented 10 years ago

hi, in the next couple of days I want have time for this.