Code Monkey home page Code Monkey logo

undocker's Introduction

undocker

License: MIT

Go library and command line tool for decomposing docker images.

Command Use

Usage

NAME:
   undocker - Decompose docker images.

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

VERSION:
   0.1.3

COMMANDS:
     extract, e  Extract to rootfs.
     show, s     Show image informations
     help, h     Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --registry-url value, -r value   docker registry url [$REGISTRY_URL]
   --registry-user value, -u value  docker registry login username [$REGISTRY_USER]
   --registry-pass value, -p value  docker registry login password [$REGISTRY_PASS]
   --help, -h                       show help
   --version, -v                    print the version

Installation

homebrew tap:

$ brew install tokibi/tap/undocker

manually:

Download binany from releases page

go get:

$ go get github.com/tokibi/undocker/cmd/undocker

Extract

Extract from local images.

$ undocker extract busybox:latest ./image
$ ls ./image
bin/  dev/  etc/  home/  root/	tmp/  usr/  var/

Extract directly from docker registry.

$ export REGISTRY_USER=xxx # optional
$ export REGISTRY_PASS=xxx # optional
$ undocker -r "https://registry-1.docker.io/" extract busybox:latest ./image

Config

Show image config.

$ undocker show config busybox:latest | jq
{
  "architecture": "amd64",
  "config": {
    "Hostname": "",
    "Domainname": "",
    "User": "",
    "AttachStdin": false,
    "AttachStdout": false,
    "AttachStderr": false,
    "Tty": false,
    "OpenStdin": false,
    "StdinOnce": false,
    "Env": [
      "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
    ],
    "Cmd": [
      "sh"
    ],
...

Library Use

Extract

Extract from local images.

func main() {
    dst := "./image"

    api, err := undocker.NewDockerAPI()
    if err != nil {
        log.Fatal(err)
    }
    api.Image("busybox", "latest").Extract(dst, false)
}

Extract directly from docker registry.

func main() {
    url := "https://registry-1.docker.io/"
    username := ""
    password := ""
    dst := "./image"

    registry, err := undocker.NewRegistry(url, username, password)
    if err != nil {
        log.Fatal(err)
    }
    registry.Image("busybox", "latest").Extract(dst, false)
}

Config

func main() {
    api, _ := undocker.NewDockerAPI()
    config, err := api.Image("busybox", "latest").Config()
    if err != nil {
        return err
    }
    fmt.Println(config.architecture)
}

undocker's People

Contributors

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