docker

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: GPL-3.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DockerUserBlocksMetadata added in v0.0.3

func DockerUserBlocksMetadata() bool

DockerUserBlocksMetadata checks if the DOCKER-USER iptables chain contains a DROP rule for 169.254.169.254. Exported for use by preflight checks that run before a DockerBackend exists.

Types

type DockerBackend

type DockerBackend struct {
	// contains filtered or unexported fields
}

DockerBackend implements backend.Backend using the Docker Engine API.

func New

func New(ctx context.Context, fullCfg *config.Config, bundleServerPath, serverVersion string) (*DockerBackend, error)

New creates a DockerBackend, verifying Docker connectivity, detecting whether the server is running inside a container, and auto-detecting how the data directory is mounted.

Takes the full *config.Config (parallel to process.New) so the backend can read both `[docker]` and the worker-resource-limit defaults that now live in `[server]`.

func (*DockerBackend) Addr

func (d *DockerBackend) Addr(ctx context.Context, id string) (string, error)

func (*DockerBackend) Build

func (*DockerBackend) CheckRVersion added in v0.0.3

func (d *DockerBackend) CheckRVersion(_ string) error

CheckRVersion returns nil — the Docker backend selects R via image tag.

func (*DockerBackend) CleanupOrphanResources added in v0.0.3

func (d *DockerBackend) CleanupOrphanResources(_ context.Context) error

CleanupOrphanResources implements backend.Backend. Removes blockyard iptables rules left over from previous runs.

func (*DockerBackend) Client added in v0.0.3

func (d *DockerBackend) Client() *client.Client

Client returns the underlying Docker API client.

func (*DockerBackend) HealthCheck

func (d *DockerBackend) HealthCheck(ctx context.Context, id string) bool

func (*DockerBackend) ListManaged

func (d *DockerBackend) ListManaged(ctx context.Context) ([]backend.ManagedResource, error)

func (*DockerBackend) Logs

func (*DockerBackend) MountCfg added in v0.0.3

func (d *DockerBackend) MountCfg() MountConfig

MountCfg returns the auto-detected mount configuration.

func (*DockerBackend) Preflight added in v0.0.3

func (d *DockerBackend) Preflight(ctx context.Context) (*preflight.Report, error)

Preflight implements backend.Backend. It runs all docker-specific preflight checks and returns a populated *preflight.Report. The full list of checks lives in this file as runDockerChecks; this method is the entry point that main.go calls through the Backend interface.

func (*DockerBackend) RemoveResource

func (d *DockerBackend) RemoveResource(ctx context.Context, r backend.ManagedResource) error

func (*DockerBackend) ServerID added in v0.0.3

func (d *DockerBackend) ServerID() string

ServerID returns the container ID of the server, or empty in native mode.

func (*DockerBackend) Spawn

func (d *DockerBackend) Spawn(ctx context.Context, spec backend.WorkerSpec) error

func (*DockerBackend) Stop

func (d *DockerBackend) Stop(ctx context.Context, id string) error

func (*DockerBackend) UpdateResources added in v0.0.3

func (d *DockerBackend) UpdateResources(ctx context.Context, id string, mem int64, nanoCPUs int64) error

UpdateResources live-updates resource limits on a running container.

func (*DockerBackend) WorkerResourceUsage added in v0.0.3

func (d *DockerBackend) WorkerResourceUsage(ctx context.Context, workerID string) (*backend.WorkerResourceUsageResult, error)

type MountConfig

type MountConfig struct {
	Mode       MountMode
	VolumeName string // MountModeVolume only: name of the Docker volume
	HostSource string // MountModeBind only: host-side path of the mount source
	MountDest  string // container-side mount destination (e.g. "/data")
}

MountConfig holds the auto-detected mount information used to create bind mounts or volume mounts for sibling containers.

func (MountConfig) ToHostPath added in v0.0.3

func (mc MountConfig) ToHostPath(serverPath string) string

ToHostPath translates a server-side path to the corresponding host path by replacing the MountDest prefix with HostSource.

func (MountConfig) TranslateMount added in v0.0.3

func (mc MountConfig) TranslateMount(m backend.MountEntry) (
	binds []string, mounts []mount.Mount,
)

TranslateMount converts a single backend.MountEntry into the appropriate Docker bind or volume mount for the detected mount mode.

func (MountConfig) WorkerMounts

func (mc MountConfig) WorkerMounts(bundlePath, libraryPath, libDir, transferDir, tokenDir, workerMount string) (binds []string, mounts []mount.Mount)

WorkerMounts returns the container HostConfig fields for a worker container. All paths are server-side; MountConfig translates them as needed.

libDir is the store-assembled per-worker library (phase 2-6); mounted ro at /lib. Host-side writes (runtime package hardlinks by the server) are visible through the bind mount regardless of the ro flag.

transferDir is pre-created for container transfer signaling (phase 2-7); mounted rw at /transfer.

libraryPath is the legacy per-bundle library from phase 2-5; used when libDir is empty (pre-store bundles).

type MountMode

type MountMode int

MountMode describes how the server's data directory is mounted.

const (
	// MountModeNative means no container detected; server path = host path.
	MountModeNative MountMode = iota
	// MountModeBind means the data path is a bind mount; paths are translated
	// by replacing the container-side prefix with the host-side source.
	MountModeBind
	// MountModeVolume means the data path is on a named Docker volume;
	// sibling containers use volume subpath mounts.
	MountModeVolume
)

type PreflightDeps added in v0.0.3

type PreflightDeps struct {
	StorePath  string
	BuilderBin string
	RedisURL   string
	Version    string
}

PreflightDeps holds the runtime values that the docker-backend preflight checks need but cannot derive from the backend itself (paths, builder cache location, optional Redis URL).

Jump to

Keyboard shortcuts

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