https://github.com/deep110/coal
Linux container creating tool like docker for learning purposes
https://github.com/deep110/coal
container docker rust
Last synced: about 1 year ago
JSON representation
Linux container creating tool like docker for learning purposes
- Host: GitHub
- URL: https://github.com/deep110/coal
- Owner: deep110
- License: apache-2.0
- Created: 2019-04-11T16:13:09.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-07-19T04:25:48.000Z (almost 4 years ago)
- Last Synced: 2025-03-25T09:19:04.065Z (about 1 year ago)
- Topics: container, docker, rust
- Language: Rust
- Homepage:
- Size: 227 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# coal
Linux container like docker for learning purposes

### Setup
1. If you don't have rust installed, follow the instructions [here](https://www.rust-lang.org/tools/install).
2. Clone and build the repository
```shell
git clone https://github.com/deep110/coal.git
cd coal && cargo build
```
3. Download alpine file system and unzip into folder named **alpine**. We will use this as a base image.
```
wget http://dl-cdn.alpinelinux.org/alpine/v3.9/releases/x86_64/alpine-minirootfs-3.9.4-x86_64.tar.gz
mkdir alpine && tar -xzf alpine-minirootfs-3.9.4-x86_64.tar.gz -C alpine
```
### Running the container
If you are running from debug build:
```
sudo target/debug/coal run /bin/sh
```
In place of bash you can run any command that will be available in alpine by default.
### Implemented [As shown in demo]
* A new process is started in run command
* Container has its own PID tree, host and network
* Limit on number of process using control groups
### Reading Material / libc functions used
* [Fork](http://man7.org/linux/man-pages/man2/fork.2.html)
* [Clone](http://man7.org/linux/man-pages/man3/exec.3.html)
* [Chroot](http://man7.org/linux/man-pages/man2/chroot.2.html)
* [Mount](http://man7.org/linux/man-pages/man2/mount.2.html)
* [Clone](http://man7.org/linux/man-pages/man2/clone.2.html)
### TODO
1. Making an `exec` command like docker.
2. Mounting additional volumes and folders.