GithubHelp home page GithubHelp logo

runcinc's Introduction

#runcic

问题背景

在k8s环境中,容器在销毁之后,除了volume内的数据其它容器内改动,都会被丢弃 k8s容器经常会发生迁移节点,这也会间接导致容器内非volume数据的丢失

runcic设计目标

runcic设计用来实现在容器内运行镜像作为子容器 当子容器随着父容器销毁,通过子容器diff通过volume实现持久化,避免了容器销毁后改动丢失

为什么runcic支持组合多个image作为一个容器运行?

这个设计相当于将y层的image,切分成x1层+x2层+x3...的多个image,其中x1+x2+x3=y 用户无需重写dockerfile组装出新的image,就可以把多个image合并为一个新的image,作为容器运行

build

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build

usage

sh runcic.sh myruncic runin   \
--copyenv   \
--env vara=a   \
--cicvolume=/data/edi/  \
--authfile=/run/secret/mysecret/.dockerconfigjson  \
golang:latest,redis:latest \ 
go env
apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  containers:
  - name: mypod
    image: runcic
    cmd:["sh","runcic.sh","myruncic","runin","--copyenv","--authfile=/run/secret/mysecret/.dockerconfigjson","golang:latest,redis:latest","go","env"]
    volumeMounts:
    - name: foo
      mountPath: "/run/secret/mysecret"
      readOnly: true
  volumes:
  - name: foo
    secret:
      secretName: mysecret

args

sh runcic.sh myapp runcic.sh负责回收runcic创建的mount路径

--copyenv 传递父容器环境变量到子容器 bool类型

--authfile 当以volume挂载kubernetes.io/dockerconfigjson类型的secret时,可以以上述形式传递

支持传递多个image,运行的时候会把image的lowerdir按顺序拼接起来,越前列的layer优先级越高

runcic的overlay文件系统

runcic的overlay文件系统,按image顺序,联合了多个image的lowerdir

例如,runcic run ubuntu:latest,centos:latest

ubuntu的lowerdir为l1:l2

centos的lowerdir为l3:l4

则,按照ubuntu:latest,centos:latest的顺序,组成的runcic overlay文件系统为 l1:l2:l3:l4

按照overlay的规则,https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html

l1是最上层的lowerdir,l4则为最下层的lowerdir

runcinc's People

Contributors

fourquadrantlogger avatar

Forkers

wangwenteng

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.