Categorygithub.com/pepabo/undocker
modulepackage
0.1.10
Repository: https://github.com/pepabo/undocker.git
Documentation: pkg.go.dev

# README

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

manually:

Download binany from releases page

go get:

$ go get github.com/pepabo/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)
}

# Packages

No description provided by the author

# Functions

No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author

# Type aliases

No description provided by the author