For AI agents: the complete documentation index is at https://www.daytona.com/llms.txt. Append .md to any docs page URL to get it as Markdown.

Sign Up
Skip to Content

Docker

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

Docker reads Docker Engine status; it never starts or restarts Docker. Obtain it through Sandbox.Docker.

Docker.Status

func (d *Docker) Status(ctx context.Context) (*DockerStatus, error)

Status returns this boot's current Docker status without waiting. An unavailable endpoint returns ErrNotFound.

Docker.WaitUntilReady

func (d *Docker) WaitUntilReady(ctx context.Context, opts *DockerWaitOptions) (*DockerStatus, error)

WaitUntilReady polls until Docker is ready, without starting it. Terminal states return *DockerNotReadyError; a spent SDK budget returns *DockerWaitTimeoutError, carrying the last status if one arrived. Caller cancellation/deadlines and Client.Close interrupt both polls and pauses.

Example:

ctx := context.Background()
client, err := daytona.New()
if err != nil {
	log.Fatal(err)
}
defer func() {
	if closeErr := client.Close(); closeErr != nil {
		log.Print(closeErr)
	}
}()
sandbox, err := client.Get(ctx, "sandbox-id", nil)
if err != nil {
	log.Fatal(err)
}
status, err := sandbox.Docker().WaitUntilReady(ctx, &daytona.DockerWaitOptions{Timeout: time.Minute})
if err != nil {
	log.Fatal(err)
}
fmt.Println(status.State)

DockerOwner

type DockerOwner string

DockerOwner identifies who manages Docker Engine.

const (
	// DockerOwnerUnknown is an unrecognized owner.
	DockerOwnerUnknown DockerOwner = "unknown"
	// DockerOwnerNone means no process manages Docker.
	DockerOwnerNone DockerOwner = "none"
	// DockerOwnerDaemon means the daemon manages Docker.
	DockerOwnerDaemon DockerOwner = "daemon"
	// DockerOwnerEntrypoint means the entrypoint manages Docker.
	DockerOwnerEntrypoint DockerOwner = "entrypoint"
)

DockerState

type DockerState string

DockerState is the last observed Docker Engine state.

const (
	// DockerStateUnknown preserves an unrecognized wire state in RawState.
	DockerStateUnknown DockerState = "unknown"
	// DockerStateNotPresent means Docker is not installed.
	DockerStateNotPresent DockerState = "not_present"
	// DockerStateDisabled means Docker is disabled.
	DockerStateDisabled DockerState = "disabled"
	// DockerStateUnmanaged means another process manages Docker.
	DockerStateUnmanaged DockerState = "unmanaged"
	// DockerStateDeferred means startup has not begun.
	DockerStateDeferred DockerState = "deferred"
	// DockerStateStarting means startup is in progress.
	DockerStateStarting DockerState = "starting"
	// DockerStateReady means Docker is usable.
	DockerStateReady DockerState = "ready"
	// DockerStateFailed means startup failed.
	DockerStateFailed DockerState = "failed"
	// DockerStateUnsupported means Docker is unsupported.
	DockerStateUnsupported DockerState = "unsupported"
)

DockerStatus

type DockerStatus struct {
	// Owner identifies the managing process.
	Owner DockerOwner
	// RawOwner is the server owner verbatim.
	RawOwner string
	// ProcessID identifies the process whose logs contain Docker output; empty
	// when the server reports none.
	ProcessID string
	// Reason is the server's explanation; empty when it gives none.
	Reason string
	// State is the normalized Docker state.
	State DockerState
	// RawState is the server state verbatim.
	RawState string
}

DockerStatus is an observed Docker Engine status.

DockerWaitOptions

type DockerWaitOptions struct {
	// Timeout defaults to one minute. WaitForever (or a value above the longest
	// supported timer, about 24.8 days) removes the SDK deadline.
	// Other negative values, including NoWait and NoTimeout, return ErrBadRequest.
	Timeout time.Duration
}

DockerWaitOptions configures a read-only Docker readiness wait.