Coder Social home page Coder Social logo

binderlay's Introduction

binderlay

Work in progress. Breaking changes will occur without notice.

Playground for mount namespaces, bind mounts, OverlayFS, etc.

Nix flake

This repository contains a Nix Flake. To refer to it, use the following Flake URL:

github:dramforever/binderlay

Running binderlay as a flake

$ nix run github:dramforever/binderlay -- <arguments>

What does it do?

$ binderlay <operations> [--] <program> <argv0> [<args...>]

binderlay will:

  • Call unshare(2) to move itself into a new user namespace and mount namespace.
  • Map the executing user's own uid and gid to be the same as the original user namespace.
  • Perform operations within the mount namespace as listed
  • execv another program with the listed argument list

Each operation is specified using several command line parameters. A lone -- terminates the operation list. The following operations are available

  • --bind <src> <dest>: Bind mount src to dest
  • --tmpfs <dest>: Mount a tmpfs on dest
  • --overlayfs <lower> <upper> <work> <dest>: Mount an OverlayFS on dest, with lowerdir=<lower>,upperdir=<upper>,workdir=<work>
  • --fs <type> <src> <options> <dest>: Mount a filesystem on dest. Similar to mount -t <type> -o <options> <src> <dest>
  • --mkdir <dest>: mkdir the directory <dest>. Currently will not also make parent directories.
  • --pivot-root <dest>: Perform a pivot_root(2) and chroot into dest

An example that runs /usr/bin/bash in a chroot with only /usr:

binderlay \
    --mkdir /tmp/work \
    --tmpfs /tmp/work \
    --mkdir /tmp/work/usr \
    --bind /usr /tmp/work/usr \
    --pivot-root /tmp/work \
    /usr/bin/bash bash

binderlay's People

Contributors

dramforever avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.