Skip to content

JosefSchoenberger/ContainerShell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ContainerShell

This provides a tool to run any shell in an containerized environment.

How to use

cargo run <base-dir> <cgroup-name> <cmd>

<base-dir> needs to be a path to a directory, which is a copied and then used as the new root. Make sure to have all necessary utils installed in it.

<cgroup-name> needs to be the canonical name of a v2 cgroup. Make sure that you have sufficient rights to add a process to the corresponding cgroup.procs file (see the Kernel Documentation) and that the cgroup has been configured correctly. Configuration would usually require superuser rights and thus is not done by this tool. See man 7 cgroups for more information.

<cmd> is the command to execute inside the container. This usually is a shell like sh, but you may choose to execute other commands.

Getting a valid base file

To test ContainerShell, I recommend the use of busybox. To use it, make sure you have busybox-static installed, then create your new base-dir and run these commands inside:

mkdir bin
cp $(which busybox) .
mv busybox bin/sh

Now you can run the command sh inside a container!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages