https://github.com/grupoudea/container-c
container created in C
https://github.com/grupoudea/container-c
Last synced: 12 months ago
JSON representation
container created in C
- Host: GitHub
- URL: https://github.com/grupoudea/container-c
- Owner: grupoudea
- Created: 2022-09-23T06:42:26.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-24T06:17:35.000Z (almost 4 years ago)
- Last Synced: 2025-05-13T19:28:23.711Z (about 1 year ago)
- Language: C
- Size: 1.88 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Container-c
Program in c for creating a container that isolate an environment for a child process,
making the right use of limit of resources and owns environment within the host machine
Using namespaces and cgroups this small container in C simulate what Docker does .
# Bash console inside the program
This program create a child process with a sh console , simulating a small OS inside the
current process , the environment variables , hostname and filesystem are isolate from
the father .
# CGroups
With cgroups tools the maximum and minimum amount of memory can be
modifiable as well as others resources as number of process that child
can create .
# How to use it
- Download the code
- execute command "make" inside the descompresed folder
- execute "sudo ./main" , sudo permissions are needed
- the main application will be executed and a child process will execute a bash console inside , that container have a small linux distribution called Alpine Linux, it was used for academic proposes because is very lightweight , so we can see how a small linux distrution runs inside the container
# Default configurations
- Does not allow to run more than 20 process
- Max memory limit 600.000 bytes (~ 0.6 mb)
# References - credits
- https://cesarvr.io/post/2018-05-22-create-containers/
- https://github.com/nathanagez/c_container
- https://devarea.com/simple-container-app-with-namespaces/#.Yy0Dv9LMJhE
- https://devarea.com/linux-control-groups/#.Yy0LtdLMJhF
- https://www.grant.pizza/blog/understanding-cgroups/
- https://docs.kernel.org/admin-guide/cgroup-v1/pids.html