{"id":18084998,"url":"https://github.com/coderofsalvation/debootstrap-container","last_synced_at":"2025-04-12T20:11:32.224Z","repository":{"id":16678527,"uuid":"19434438","full_name":"coderofsalvation/debootstrap-container","owner":"coderofsalvation","description":"simple way of running multiple debian containers on a (openvz) VPS (instead of docker )","archived":false,"fork":false,"pushed_at":"2020-05-28T18:47:27.000Z","size":171,"stargazers_count":19,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T14:22:29.595Z","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":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coderofsalvation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":"https://gumroad.com/l/hGYGh"}},"created_at":"2014-05-04T19:44:10.000Z","updated_at":"2024-12-20T01:17:22.000Z","dependencies_parsed_at":"2022-08-25T19:50:45.827Z","dependency_job_id":null,"html_url":"https://github.com/coderofsalvation/debootstrap-container","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderofsalvation%2Fdebootstrap-container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderofsalvation%2Fdebootstrap-container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderofsalvation%2Fdebootstrap-container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderofsalvation%2Fdebootstrap-container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderofsalvation","download_url":"https://codeload.github.com/coderofsalvation/debootstrap-container/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625493,"owners_count":21135513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-10-31T15:08:59.739Z","updated_at":"2025-04-12T20:11:32.201Z","avatar_url":"https://github.com/coderofsalvation.png","language":"Shell","funding_links":["https://gumroad.com/l/hGYGh"],"categories":[],"sub_categories":[],"readme":"debootstrap-container\n=====================\n\n\u003cimg src=\".res/logo.png\"/\u003e\n\nsimple way of running multiple debian ssh-able containers on a (openvz) VPS \n\n\u003e CAUTION: this shellscript requires root, use at own risk.\n\n# Usage\n\n    Usage: \n    \n    debootstrap-container delete \u003ccontainername\u003e\n    debootstrap-container add \u003ccontainername\u003e [release] [variant]\n    debootstrap-container run \u003ccontainerdir/name\u003e \n    debootstrap-container showreleases\n\n### Howto\n\n    $ sudo debootstrap-container add foo\n    enter user which should be 'root'? foo \n    adding new user 'foo'\n    Enter new UNIX password: \n    Retype new UNIX password: \n    passwd: password updated successfully \n    redirect user into container upon ssh-login? (y/n) y\n    [x] created container '/srv/containers/foo'\n\n    $ ssh foo@localhost\n    foo@foo# whoami\n    uid=1003(foo) gid=1004 groups=1004\n\n    foo@foo# sudo whoami\n    root\n\n    foo@foo# sudo apt-get install python2\n    foo@foo# exit\n\nnow the funpart is: python2 is only installed in the container, and the sudo is \nactually fakeroot.\n\n### Why\n\nI am a huge fan of [docker](http://docker.io) but unfortunately I had to do multiple projects inside one VPS server.\nI could not get docker working, and solutions like [sekexe](https://github.com/jpetazzo/sekexe) or jailkit pointed into more possible hassle.\nI had to go another road to satisfy my needs:\n\n* I want to install packages in a container, *outside* the real host\n* I want to easily backup/restore containers\n* I want to run node- or apache/lighttpd applications in a container\n* I want to ssh to a container and feel like I have root-access\n* I want to be somewhat compatible with docker\n* Doesnt use too much diskspace (bare debootstrap container is 124mb)\n\n### Docker compatibility\n\nIt *should* be compatible with docker, just tar your jail-dir like so:\n\n    tar -C /srv/containers/mycontainer -c . | docker import myname/mycontainer\n\n### TIP: shared directories\n\nSharing directories across containers (originating from outside the container) can be handy.\nHowever, avoid symbolic links since it will confuse applications when resolving absolute paths, instead mount like so:\n\n    mount --bind /opt/somefolder /srv/containers/mycontainer/opt/somefolder\n\n\u003e WARNING: always use 'debootstrap-container delete \u003cyourcontainer\u003e' to delete a container.\nUsing a plain 'sudo rm -rf /srv/containers/yourcontainer' might cause dataloss for folders using 'mount --bind'\n\n### TIP: persistent containers\n\nTo keep the container alive after logouts/timeouts, first get a passwordless ssh-login working:\n \n    $ su foo\n    foo $ ssh-keygen \u003center\u003e\u003center\u003e\u003center\u003e\n    foo $ ssh-copy-id foo@localhost\n    foo $ exit\n    $ ln -fs /srv/containers/foo/home/foo/.ssh /home/foo/.\n\nThen: \n \n* run gnu 'screen' as root (apt-get install screen)\n* inside this screen, ssh into your container(s) (ssh foo@localhost)\n* and leave it there (ctrl A-D)\n\nBy doing so, the master-screen process will always be persistent, and you can just ssh from anywhere directly into your ssh-container. You can even run a screen inside your container if you want to.\nThe following files would automate this:\n\n/root/.screen \n\n    screen -T xterm -t container_foo 1 su foo -c 'ssh foo@localhost'\n    screen -T xterm -t container_bar 2 su bar -c 'ssh bar@localhost'\n\n/etc/init.d/screen \n\n    #!/bin/bash\n    find /srv/containers -mindepth 1 -maxdepth 1 -type d | while read dir; do       \n      /root/lemon/server/debootstrap-container/debootstrap-container mount_dirs \"$dir\"\n    done\n    echo /usr/bin/flock -w 0 /root/.screen.lock /usr/bin/screen -s /bin/bash -d -m \u0026\n\nThis would mount some needed folders (/sys /proc) and start+detach the screen during startup.\nTo start services by default just do something like:\n\n    echo \"/etc/init.d/mysql status || /etc/init.d/mysql restart\" \u003e\u003e /srv/containers/foo/.bashrc\n\n### Sudo \n\nThe containers use a sudo-shellscript at /usr/bin/sudo which uses fakeroot.\nTo prevent users from installing software please remove the /usr/bin/fakeroot binary.\n\n### History\n\n* Sun Apr 26 21:43:47 CEST 2015 refactor: debootstrap doesnt run by root-user, but with sudo cmds\n* Sun Apr 26 21:43:47 CEST 2015 refactor: added remove function \n* Mon Apr 27 12:53:50 CEST 2015 refactor: removed import/export: just tar the container at /src/container/*\n\n### Conclusion\n\nThis is definately not secure or as cool as docker, but it is an tidy way to deploy\napplications on a openvz container (which doesnt run docker).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderofsalvation%2Fdebootstrap-container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderofsalvation%2Fdebootstrap-container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderofsalvation%2Fdebootstrap-container/lists"}