Skip to content

M-k-Hack/Kubi

Repository files navigation

Kubi

Kontainer Unified By Internet


logo

Orchestrate containers with an Express API.

Table of Contents

Introduction

Contributors Forks Stargazers Issues MIT License

We need to orchestrate container for a CTF by a simple way. So we created this.

Features

Some things than you can do with Kubi :

  • You can run containers with a simple web request on a random port.
  • You can upload docker images to run it.
  • You have a (not really) nice web interface to interact with endpoints.

Feedback

Feel free to send us feedback. File an issue.

Contributors

At the moment, only MAK'HACK members can contribute to this project.

Requirements

  • Docker
  • MongoDB
  • NodeJS
    • express
    • mongoose
    • dockerode
    • dotenv
    • body-parser

Build Process

Docker

First, install Docker.

For the first launch, build a random image (like ubuntu) to test running :

docker pull ubuntu

MongoDB

First, you have to install Mongo, create a database and a user for the database with readWrite permissions.

Also don't forget to enable Access Control for your MongoDB instance.

If your MongoDB instance is not on the same machine, change your bind_ip in /etc/mongod.conf to 0.0.0.0.

If you built the docker image ubuntu previously, Add a line in your mongoDB just created (don't forget to auth):

db.containers.insert({name:"My Nice Ubuntu Image", name_container:"ubuntu", "exposed_port":22})

Node Express Back-End

Now, clone the project :

git clone https://github.com/M-k-Hack/Kubi.git

Create a .env file under a directory called ./vars/, and add your credententials, etc... :

ADMIN_TOKEN=
DB_HOST=
DB_USER=
DB_PASSWORD=
DB_NAME=
DB_PORT=

Install dependencies and run project :

npm install
sudo node server.js

Endpoints

GET /api/docker/start/:id --> Start a container with and id specified
GET /api/docker/stop/:id --> Stop container (only for admin)
GET /api/container/ --> Get all containers stored in Mongo Databases
GET / --> Web Interface (Pure HTML/CSS/JS)

Front-End

Express App serves a web interface. You can use to test good functionalities or in your projet. But you can also create your own front-end app to use the API.

Acknowledgments

Thanks to MAK'HACK members and creators of dockerode.

License

MIT License.

About

Kubi is a docker orchestrer via web request.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published