Giter Club home page Giter Club logo

cont's Introduction

Cont

A toy container runner & orchestrator.

Currently supports:

  • running containers interactively (PTY) or in detached mode
  • killing active containers
  • listing active containers
  • isolated mounts, network, user namespaces, process namespace...
  • rootless containers by default
  • custom container hostname

Usage

cont basic demo

Check out help with go run cmd/cli/cli.go help.

Examples:

  • go run cmd/cli/cli.go run --it bash - run bash in an isolated container with a pseudo terminal
    • go run cmd/cli/cli.go run --host <hostname> --it bash - run bash in an isolated container with a pseudo terminal through a multiplexed TCP connection
  • go run cmd/cli/cli.go attach --it <container_id> - attach to a running container
    • go run cmd/cli/cli.go attach --host <hostname> --it <container_id> - attacho to a container with a pseudo terminal through a multiplexed TCP connection
  • go run cmd/cli/cli.go ps - list running containers
  • go run cmd/cli/cli.go --host <hostname> ps - list running containers on a remote host
  • go run ./cmd/cli/cli.go run --host <hostname> --share-ns "$container_id" --it --name shared bash
    • share namespaces with an existing container container_id
    • requires daemon to be run as root (because of setns)
    • ip link add dummy0 type dummy - dummy interface will be shown in both processes (ip addr)

Daemon: go run cmd/daemon/daemon.go

High level architecture

  • CLI
    • communicates with daemons through gRPC and handles IPC
    • each interactive session is connected in a separate pseudo terminal and streams data in & out
  • daemon
    • communicates with clients and runs the containers
    • TCP connections are multiplexed in multiple streams and stream container stdin, stdout & stderrs

cont architecture

TODO

  • local container access (ironically)
  • remote container orchestration (IPC through TCP sockets)
  • inter-container networking
  • running different OSes
  • volume mounts
  • contfiles & builds
  • killing containers through CLI (almost!)
  • secure gRPC communication
  • separate -i and -t options (attach STDIN and PTY)
  • tee stdout & stderr to logfiles (rotated daily or every 10MB)
  • attaching container namespaces on the same host
  • init pipe instead of env vars
  • clone binary

Examples

$ go run cmd/cli/cli.go run --it --name test123 --hostname kontejner --workdir /home/fhancic bash
$ whoami
root
$ hostname
kontejner
$ pwd
/home/fhancic
$ go run cmd/cli/cli.go ps
|                 UUID                 | CMD  |  PID   |  NAME   |
|--------------------------------------|------|--------|---------|
| 250c137e-a173-410e-8b81-1161e4979d04 | bash | 512306 |         |
| fc7467b9-d63d-4c05-b6fb-5a61458903ea | bash | 512088 | test123 |

Acknowledgments

cont's People

Stargazers

 avatar

Watchers

 avatar  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.