libsquash

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2014 License: MIT Imports: 14 Imported by: 0

README

libsquash

Library

GoDoc

This is based on jwilder/docker-squash, but the squashing functionality is extracted into a package named libsquash

libsquash is different from docker-squash in that libsquash...

  1. does not write to disk
  2. does not require sudo
  3. does not depend on the installation of any particular version of tar (or any version at all)

Other information:

Binary

Installation
go get github.com/winchman/libsquash/docker-squash
Usage

docker-squash works by squashing a saved image and loading the squashed image back into docker.

$ docker save <image id> > image.tar
$ sudo docker-squash -i image.tar -o squashed.tar
$ cat squashed.tar | docker load
$ docker images <new image id>

You can also tag the squashed image:

$ docker save <image id> > image.tar
$ sudo docker-squash -i image.tar -o squashed.tar -t newtag
$ cat squashed.tar | docker load
$ docker images <new image id>

You can reduce disk IO by piping the input and output to and from docker:

$ docker save <image id> | sudo docker-squash -t newtag | docker load

If you have a sufficient amount of RAM, you can also use a tmpfs to remove temporary disk storage:

$ docker save <image_id> | sudo TMPDIR=/var/run/shm docker-squash -t newtag | docker load

By default, a squashed layer is inserted after the first FROM layer. You can specify a different layer with the -from argument.

$ docker save <image_id> | sudo docker-squash -from <other layer> -t newtag | docker load

If you are creating a base image or only want one final squashed layer, you can use the -from root to squash the base layer and your changes into one layer.

$ docker save <image_id> | sudo docker-squash -from root -t newtag | docker load

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Verbose bool

Functions

func Squash

func Squash(instream io.Reader) (outstream io.Reader, err error)

Types

type Config

type Config struct {
	AttachStderr    bool
	AttachStdin     bool
	AttachStdout    bool
	Cmd             []string
	CpuShares       int64
	Dns             []string // For Docker API v1.9 and below only
	Domainname      string
	Entrypoint      []string
	Env             []string
	ExposedPorts    map[Port]struct{}
	Hostname        string
	Image           string
	Memory          int64
	MemorySwap      int64
	NetworkDisabled bool
	OnBuild         []string
	OpenStdin       bool
	PortSpecs       []string
	StdinOnce       bool
	Tty             bool
	User            string
	Volumes         map[string]struct{}
	VolumesFrom     string
	WorkingDir      string
}

type ContainerConfig

type ContainerConfig struct {
	AttachStderr    bool
	AttachStdin     bool
	AttachStdout    bool
	Cmd             []string
	CpuShares       int64
	Dns             []string
	Domainname      string
	Entrypoint      []string
	Env             []string
	Hostname        string
	Image           string
	Memory          int64
	MemorySwap      int64
	NetworkDisabled bool
	OnBuild         []string
	OpenStdin       bool
	PortSpecs       []string
	StdinOnce       bool
	Tty             bool
	User            string
	Volumes         map[string]struct{}
	VolumesFrom     string
}

type LayerConfig

type LayerConfig struct {
	Id                string           `json:"id"`
	Parent            string           `json:"parent,omitempty"`
	Comment           string           `json:"comment"`
	Created           time.Time        `json:"created"`
	V1ContainerConfig *ContainerConfig `json:"ContainerConfig,omitempty"`  // Docker 1.0.0, 1.0.1
	V2ContainerConfig *ContainerConfig `json:"container_config,omitempty"` // All other versions
	Container         string           `json:"container"`
	Config            *Config          `json:"config,omitempty"`
	DockerVersion     string           `json:"docker_version"`
	Architecture      string           `json:"architecture"`
}

func (*LayerConfig) ContainerConfig

func (l *LayerConfig) ContainerConfig() *ContainerConfig

type Port

type Port string

func (Port) Port

func (p Port) Port() string

Port returns the number of the port.

func (Port) Proto

func (p Port) Proto() string

Proto returns the name of the protocol.

type TagInfo

type TagInfo map[string]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL