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

Make overriding "default" repo possible #226

Closed ruipin closed 9 years ago

ruipin commented 9 years ago

I wanted to add OpenGL acceleration support to the xpra image. For that, I was playing around with the image in my local system, but I noticed that no matter what changes I made, it wouldn't apply them.

I would for example add

RUN echo "something"

to the dockerfile for xpra, and it wouldn't run it. To make sure my changes weren't being ignored, I renamed the "repositories/default/xpra" folder, removed all docker images through

docker rm $(docker ps -a -q)
docker rmi $(docker images -q)

but it just reinstalls the default xpra image as if the files were still there.

I tried to understand what was happening in the Python code, but I'm still not familiar enough with the code-base to be able to find anything "special" that explains this, though.

I managed to get it to use my changes by forking the default repositories, editing data/repositories.json to point to my fork, commiting changes, deleting all docker images through the above commands, and then delete the subuser registry and repositories folder, and then re-add my subuser.

But I have been unable to get it to use my changed xpra dockerfile without repeating that whole process every time I want to change something.

timthelion commented 9 years ago

Why would you want to do this? It is already possible to do this by creating a repositories.json file in $HOME/.subuser/repositories.json, or /etc/subuser/repositories.json as described in the repositories.json standard. However, doing so, would mess up the XPRA X11 bridge, as the XPRA images are built from default.

ruipin commented 9 years ago

Well, I noticed that the Xpra bridge complains in the console on how OpenGL support isn't active (it doesn't have python-numby and some other packages installed). I was looking into fixing this (it should be a matter of also installing the missing packages), but couldn't find a way to override the xpra image file.

timthelion commented 9 years ago

You cannot edit the files in ~/.subuser/repositories/ because subuser's update system is atomic and tracks git hashes (rather than checked out files). The proper way of developing the default repository is to create a ~/.subuser/repositories.json file which looks like:

{
 "default" : {"source-dir" : "/path/to/new/default/repo"}
}

This will over-ride the default default repository and will use the actual files (not what is checked into git) found in the specified path.

timthelion commented 9 years ago

If you were to write:

{
 "default" : {"git-origin" : "file:///path/to/new/default/repo"}
}

Then it would use the files checked into the master branch of the same location.

ruipin commented 9 years ago

Huh. That explains quite a bit. Just tested it and it works, thanks.