Documentation ¶
Index ¶
Constants ¶
const ( // TitleLabel is the label added to Docker images to track the title of // snapshots. TitleLabel = "dksnap.title" // CreatedLabel is the label added to Docker images to track the creation // time of snapshots. CreatedLabel = "dksnap.created" // DumpPathLabel is the label added to Docker images to track the path // within the container of a dump representing the state of the database. DumpPathLabel = "dksnap.dump-path" // BaseEntrypointLabel is the label added to Docker images to track the // original entrypoint of a Docker image. dksnap overwrites the entrypoint // to injects its boot logic, so we must keep track of the original // entrypoint separately in order for snapshots of snapshots to work. BaseEntrypointLabel = "dksnap.base-entrypoint" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Generic ¶
type Generic struct {
// contains filtered or unexported fields
}
Generic creates snapshots by saving the container's filesystem with `docker commit`, and creating a tarball for each attached volume. The new container's entrypoint is then modified to load the volumes at boot.
type Mongo ¶
type Mongo struct {
// contains filtered or unexported fields
}
Mongo creates snapshots for Mongo containers. It dumps the database using `mongodump`.
type MySQL ¶
type MySQL struct {
// contains filtered or unexported fields
}
MySQL creates snapshots for MySQL containers. It dumps the database using `mysqldump`.
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
Postgres creates snapshots for Postgres containers. It dumps the database using pg_dumpall.
type Snapshot ¶
type Snapshot struct { // BaseImage represents whether the image is a regular Docker image, and // not created by `dksnap`. Title, DumpPath, and Created are not defined // BaseImage is true. BaseImage bool Title string DumpPath string ImageNames []string Created time.Time ImageID string Parent *Snapshot Children []*Snapshot }
Snapshot represents a snapshot of a container. It can be booted by running referenced image.
type Snapshotter ¶
type Snapshotter interface {
Create(ctx context.Context, container types.ContainerJSON, title, imageName string) error
}
Snapshotter defines the interface for creating snapshots. Implementations may make assumptions about the type of container that is being snapshotted. For example, the Postgres snapshotter shells out to `pg_dumpall`.
func NewGeneric ¶
func NewGeneric(c *client.Client) Snapshotter
NewGeneric creates a new generic snapshotter.
func NewMongo ¶
func NewMongo(c *client.Client) Snapshotter
NewMongo creates a new mongo snapshotter.
func NewMySQL ¶
func NewMySQL(c *client.Client) Snapshotter
NewMySQL creates a new mongo snapshotter.
func NewPostgres ¶
func NewPostgres(c *client.Client, dbUser string) Snapshotter
NewPostgres creates a new Postgres snapshotter.