{"id":19336794,"url":"https://github.com/samrocketman/containers-aux","last_synced_at":"2026-06-09T20:31:04.660Z","repository":{"id":145441887,"uuid":"124367538","full_name":"samrocketman/containers-aux","owner":"samrocketman","description":"Static binaries READONLY copy of https://github.com/agordon/containers-aux","archived":false,"fork":false,"pushed_at":"2020-10-18T07:11:59.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-24T08:13:36.408Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samrocketman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-08T09:20:11.000Z","updated_at":"2018-04-08T03:22:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"940b81c4-b969-4803-b6c1-c547fcad2b35","html_url":"https://github.com/samrocketman/containers-aux","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/samrocketman/containers-aux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samrocketman%2Fcontainers-aux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samrocketman%2Fcontainers-aux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samrocketman%2Fcontainers-aux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samrocketman%2Fcontainers-aux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samrocketman","download_url":"https://codeload.github.com/samrocketman/containers-aux/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samrocketman%2Fcontainers-aux/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34125332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T03:12:28.058Z","updated_at":"2026-06-09T20:31:04.632Z","avatar_url":"https://github.com/samrocketman.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Containers - Auxiliary Programs\n===============================\n\nThis is a collection of supporting programs/scripts for\nChris Webb's [containers](https://github.com/arachsys/containers) project.\n\n**Containers** are light-weight wrappers for the Linux-Containers interface\n(think of it as more than `unshare(1)` and less than full-fledged `lxc` or\n`docker`).\n\n\nInstallation\n------------\n\nFirst, install containers:\n\n    git clone https://github.com/arachsys/containers.git\n    cd containers\n    make\n    # optional\n    sudo make install\n\nSecond, compile these programs:\n\n    git clone https://github.com/agordon/containers-aux.git\n    cd containers-aux\n    make\n    # optional\n    sudo make install\n\nNOTE:\nThe default containers installation installs `contain` as SUID executable.\nDepending on your setup and needs, this might not be required.\n\n\nAvailable programs/scripts\n--------------------------\n\n### list-containers\n\nThe containers package provides minimal functionality\nwithout any management layer (that is on purpose, see\n[this post](https://github.com/arachsys/containers/pull/2#issuecomment-134204055) ).\n\n`list-containers` will search for running containers and print them to\nSTDOUT (saving just a bit of fiddling with PIDs).\n\nTypical usage:\n\n    $ contain /tmp/foo /bin/sh\n    $ list-containers\n    PID  init-pid(1)  init-cmd  root-dir\n    458  10468        /bin/sh   /tmp/foo\n\nPID (458) is the container, can be used with 'inject':\n\n    $ CID=$(list-containers -fb) || exit\n    $ inject \"$CID\" /bin/echo hello world\n\n### create-container-rootfs.sh\n\nThe `create-container-rootfs.sh` creates a directory with template a\nroot-filesystem that can be used for a quick container setup. The\ndirectory will contain:\n\n1.  `/bin` - with some binaries copied from the host's `/bin/`,\n    `/usr/bin`, etc. It will include `perl` and `python`.\n\tAll binaries can be replaced or removed (or added).\n\tSee also the static coreutils/busybox below.\n\n2.  various `lib` directories (e.g. `/usr/lib`) - created empty,\n    and will be bind-mounted with the container startup helper\n\tscripts (see below).\n\n3.  `/etc/` - few files such as `passwd`,`bash.bashrc`,`init.d/rcS`\n    are created to facilitate easier startup inside the container.\n\n4.  `/var` and `/tmp` directories, with world-writable access\n    and sticky-bits turned on.\n\nTo customize the container, edit `./etc/init.d/rcS` and add initialization\ncode.\n\n### setup-user-mapping.sh\n\nCreates two non-root users on the host: `lxc_root` and `lxc_user`,\nand their corresponding groups. Adds mapping from the given user\n(the operator, you) to these users in `/etc/sub{u,g}id` -\nenabling `contain` to setup user namespace mapping.\nThis needs to be run only once, and will work for all later containers.\nMapping can be use explicitly with `contain`'s `-u`/`-g` options,\nor automatically with the `contain-user-host` helper script.\n\nExample:\n\n    $ who am i\n\tgordon\n    $ sudo ./setup-user-mapping.sh gordon\n\nWill enable user `gordon` to later run `contain-user-host` with user mapping\nof `lxc_root` and `lxc_user`.\n\n### contain-* scripts\n\nThe scripts starts a container with user namespace mapping and\nbind-mounting host's `lib` directories (based on a previously created\nroot-filesystem directory with `create-container-rootfs.sh`).\n\nThe scripts are:\n\n1.  `contain-host` - performs host bind-mounting of `lib` directories.\n2.  `contain-user-host` - same as above, adds automatic user namespace\n    mapping of `root` to `lxc_root` and `user` to `lxc_user`. See\n    `setup-user-mapping.sh` script.\n3.  `contain-interactive` - same as above, takes one parameter (the\n    root-filesystem directory) and automatically starts `/bin/bash` as\n\ta login shell with the contained root user.\n4.  `contain-background-daemon` - same as #2, takes one parameter (the\n    root-filesystem directory) and automatically starts\n    `/etc/init.d/rcS` as a background process (runs the container with\n    `nohup` and returns immediately)\n\nExamples:\n\nCreate a container rootfs directory, start the container as the current\nuser (root in the container is the current user, no user-namespace mapping):\n\n    $ ./create-container-rootfs.sh foobar\n\t$ ./contain-host ./foobar /bin/sh\n\nCreate a container rootfs directory, start the container with user namespace\nmapping (root in the container is the `lxc_root` user on the host, non-root user\nin the container is the `lxc_user` user on the host). `contain` must be installed\nas suid binary (or use sudo) for this to work:\n\n    $ ./create-container-rootfs.sh foobar\n\t$ ./contain-user-host ./foobar /bin/bash -l\n\nThe following are equivalent:\n\n\t$ ./contain-user-host ./foobar /bin/bash -l\n    $ ./contain-interactive ./foobar\n\nThe following are equivalent way of running the container's init sequence\nin the background:\n\n\t$ nohup ./contain-user-host -c ./foobar /bin/sh /etc/init.d/rcS \u0026\n    $ ./contain-background-daemon ./foobar\n\n\n### create-static-busybox\n\nThe `create-static-busybox.sh` script downloads and builds the latest\n[busybox](http://www.busybox.net/) binary, and creates a directory\nstructure suitible to be used as a container root directory.\nThe binary is statically-linked, and does not require any shared-libraries\n(resulting in a very simple root directory structure).\n\nTypical usage:\n\n    $ ./create-static-busybox.sh foo\n\nThen wait while busybox is being compiled. Once done,\na `foo` directory will be created, containing all the busybox\napplets (e.g. `sh`,`awk`,`sort`,`ifconfig`, etc.) in the `bin` directory.\nTo use it as a container, run:\n\n    $ contain ./foo\n    (( inside the container , many common programs are availalbe in /bin ))\n\n    # awk 2\u003e\u00261 | head -n1\n    BusyBox v1.24.0.git (2015-08-26 14:53:43 EDT) multi-call binary.\n\n    # sort -h 2\u003e\u00261 | head -n2\n    sort: invalid option -- 'h'\n    BusyBox v1.24.0.git (2015-08-26 14:53:43 EDT) multi-call binary.\n\n\n### create-static-coreutils\n\nStarting with GNU Coreutils version 8.24, coreutils can be built as a single\nstatic binary (similar to busybox) - which greatly simplifies usage inside\ncontainers. The `create-static-coreutils.sh` script downloads and builds\n[GNU coreutils](http://www.gnu.org/software/coreutils), then\ncreates a a directory with hard-linked files to the `coreutils` single-binary.\n\nTypical usage:\n\n    $ ./create-static-coreutils.sh foo\n\nThen wait while GNU coreutils is being compiled. Once done,\na `foo` directory will be created, containing the `coreutils`\nbinary and links to the various programs (e.g. `cp`,`rm`,`sort`,`head`, etc.)\nin the `bin` directory. To use it as a container, run:\n\n    $ contain ./foo /bin/sort --help\n\n**NOTE:**\n\n1.  `busybox` includes many of the same utilities (e.g. `sort`,`cp`) as\n    GNU coreutils, but with limited funtionality. Depending on your needs,\n    you might prefer to override the busybox utils with GNU coreutils.\n2.  `busybox` includes a shell (`ash`, installed as `./busybox-container/bin/sh`) -\n    so it can be easily used as a container root directory with interactive shell.\n    GNU `coreutils` does *not* include a shell - a container directory\n    created by `create-static-coreutils.sh` will not suffice to run\n    an entire container shell.\n3.  Common usage will be to first create the busybox container (with shell,\n    and many other utilities), then install (and override) it with the\n    GNU coreutils programs:\n\n        $ ./create-static-busybox.sh foo\n        $ ./create-static-coreutils.sh foo\n        $ contain ./foo /bin/sh\n        (( inside the container , awk is busybox, and sort is GNU coreutils ))\n\n        # awk 2\u003e\u00261 | head -n1\n        BusyBox v1.24.0.git (2015-08-26 14:53:43 EDT) multi-call binary.\n\n        # sort --version | head -n1\n        sort (GNU coreutils) 8.24\n\n### create-static-file-magic\n\nThe `create-static-file-magic.sh` script downloads and builds a static\nversion of the `file(1)` program (the magic file detection utility).\n\nTypical usage:\n\n    $ ./create-static-file-magic.sh foo\n\nThen wait while libmagic/file are being compiled. Once done,\na `foo` directory will be created, containing the `./bin/file` binary\nand `/share/misc/magic.mgc` database.\nTo use it as a container, run:\n\n    $ contain ./foo /bin/file --help\n\n**NOTE:**\n\n`file` by itself is not sufficient for a self-contained container.\ntypically this would be combined with busybox/coreutils programs:\n\n\n        $ ./create-static-busybox.sh foo\n        $ ./create-static-file-magic.sh foo\n        $ contain ./foo /bin/sh\n        (( inside the container , 'file' is available ))\n\n        # file --version\n        file-5.24\n        magic file from /share/misc/magic\n\n        # file /bin/sh\n        /bin/sh: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, for GNU/Linux 2.6.24, stripped\n\n### create-static-7za\n\nSame as above, creates a static `7za` binary executable (7z (de)compression program).\n\n        $ ./create-static-7za.sh foo\n\nInstalls the static binary in `./foo/bin/7za`.\n\n### contain-host\n\nThe `contain-host` script uses bind-mounts to create a replica of\nthe host's directory structure. This is an alternative to the `tar + pseudo`\nexample shown in the _containers_'s README file.\n\nTypical usage:\n\n    $ mkdir foo\n    $ contain-host foo /bin/bash\n    bash-4.3#\n\nThe 'bash-4.3' prompt is inside the container, and in it,\n `/bin`, `/sbin`, `/usr/bin`, `/usr/sbin`, `/usr/local/bin`,\n `/usr/local/sbin` (including the relevant `*/lib` directories)\nare all mirrored from the host.\n\nWhen the contained process terminates, the bind-mounts are automatically\nunmounted.\n\n\nContact\n-------\n\nAssaf Gordon\n\nAssafgordon@gmail.com\n\nhttps://github.com/agordon\n\nLicense: MIT\n\nAdditional files:\n\n    Makefile, utils.c, contain.h:\n      copied from \u003chttps://github.com/arachsys/containers\u003e\n      Copyright (C) 2013 Chris Webb \u003cchris@arachsys.com\u003e\n      License: MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamrocketman%2Fcontainers-aux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamrocketman%2Fcontainers-aux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamrocketman%2Fcontainers-aux/lists"}