Giter VIP home page Giter VIP logo

docker-clone's Introduction

docker-clone

Purpose of this project

I wanted to explore linux namespaces and understand how docker works internally.

This project is a toy docker implementation in C

Features

  • An overlayfs is used to create containers from images, thereby saving time on extraction of the image.
  • Uses pivot_root to change the root of the container
  • Creates a new UTS, PID and NET namespace for the container
  • A veth pair is used to connect the container to an existing docker0 bridge

Usage

First compile the application

$ gcc -O3 main.c run.c utils.c container.c -o container -std=gnu11

Then run the program with

$ sudo ./container run <image_name> <command>

Example:

$sudo ./container run ubuntu bash

Note: The image file must be present in the images/ directory with the following structure images/<image_name>.tar.gz

The image file must be a compressed root filesystem

Get an alpine linux image from here and save it as images/alpine.tar.gz

For example, images/ubuntu.tar.gz

TODOS

  • Better handling of command line arguments
  • Command to build, create, view and download containers and images
  • Create a new bridge with routing instead of reusing docker0
  • Configuration files
  • cgroups, setuid and seccomp

References

This project is based on https://github.com/Fewbytes/rubber-docker, but is implemented in C.

docker-clone's People

Contributors

ananthvk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.