Giter VIP home page Giter VIP logo

oci2docker's Introduction

#oci2docker - Convert OCI bundle to docker image

oci2docker is a small library and CLI binary that converts OCI bundle to docker image. It takes OCI bundle as input, and gets docker image as output.

How it works

An important work of oci2docker is converting OCI Specs to Dockerfile, below is a list of conversion principle:

config.json

Root Configuration

OCI Specs Dockerfile
path ADD

Process configuration

OCI Specs Dockerfile
env ENV
cwd WORKDIR
args ENTRYPOINT
user USER

Mount Points

OCI Specs Dockerfile
mounts VOLUME

runtime.json

Mount Configuration

OCI Specs Dockerfile
mounts VOLUME

Hooks

OCI Specs Dockerfile
Poststart CMD

Build

Installation is as simple as:

go get github.com/huawei-openlab/oci2docker

or as involved as:

# create a 'github.com/huawei-openlab' in your GOPATH/src
cd $GOPATH/src/github.com/
mkdir huawei-openlab
cd huawei-openlab
git clone https://github.com/huawei-openlab/oci2docker.git
cd oci2docker
make
sudo make install

Usage

$ ./oci2docker
NAME:
   oci2docker - A tool for coverting oci bundle to docker image

USAGE:
   oci2docker [global options] command [command options] [arguments...]

VERSION:
   0.1.0

COMMANDS:
   convert      convert operation
   help, h      Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h           show help
   --version, -v        print the version

$ ./oci2docker convert
NAME:
   convert - convert operation

USAGE:
   command convert [command options] [arguments...]

OPTIONS:
   --oci-bundle "oci-bundle"    path of oci-bundle to convert
   --image-name "image-name"    docker image name
   --port                       exposed port of docker images

Example

$ ./oci2docker convert --oci-bundle example/oci-bundle/ --image-name cts/hello-docker
DEBU[0000] Docker build context is in /tmp/oci2docker911067878
 
Sending build context to Docker daemon 1.031 MB
Sending build context to Docker daemon 
Step 0 : FROM scratch
 ---> 
Step 1 : MAINTAINER ChengTiesheng <[email protected]>
 ---> Using cache
 ---> c6fd471de5d0
Step 2 : ADD ./rootfs .
 ---> 319ffc8c52a7
Removing intermediate container 4bdbe7abd980
Step 3 : ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin TERM xterm
 ---> Running in 5fde4642d6d3
 ---> 11ec7f4bdb2f
Removing intermediate container 5fde4642d6d3
Step 4 : ENTRYPOINT /bin/sh
 ---> Running in d47b25f16d80
 ---> 2f6dedb309af
Removing intermediate container d47b25f16d80
Successfully built 2f6dedb309af

$ docker run -i -t cts/hello-docker
/ # 

oci2docker's People

Contributors

chengtiesheng avatar

Stargazers

Markus Geiger avatar  avatar

Watchers

James Cloos avatar Victor HU avatar Meaglith Ma avatar Leo Meng avatar Wang Qilin avatar  avatar 梁辰晔 (Liang Chenye) 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.