docker

package
v0.1.157 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package docker is the codefly Docker toolbox — image and container operations exposed as typed Tool RPCs.

This is the canonical replacement for `bash -c "docker ..."`. Agents wanting to inspect images, list containers, or query a running container's state call typed RPCs here; the Bash toolbox refuses every `docker` invocation and routes callers via canonical_for: docker.

Implementation uses the official Docker SDK (already a core dependency via runners/base/docker_runner.go). No shell-out to /usr/bin/docker.

Phase 1 ships a deliberately minimal tool set proving the contract: docker.list_containers, docker.list_images, docker.inspect_container. Mutation tools (run, exec, kill) come later — they need careful thinking about the boundary between "Docker toolbox runs containers for agents" vs "service plugins manage their own runtime via runners/base.DockerEnvironment." Almost certainly the toolbox will expose only inspection + a tightly-scoped exec; container lifecycle stays with service plugins.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	*registry.Base
	// contains filtered or unexported fields
}

Server implements codefly.services.toolbox.v0.Toolbox for Docker inspection ops.

Constructed lazily — the Docker daemon connection isn't established until the first tool call. This means a Server is cheap to create and tests don't need a live daemon to exercise schema/dispatch logic; only the daemon-touching tools need it.

The lazy init is once-only and safe under concurrent CallTool — sync.Once guards the client creation so concurrent first callers don't both create + leak Docker clients (a real bug caught in review of an earlier draft that did read-then-write without a lock).

func New

func New(version string) *Server

New returns a Server.

func (*Server) Close

func (s *Server) Close() error

Close releases the Docker SDK client. Idempotent.

Calling Close before any CallTool is a no-op (initOnce hasn't fired). Calling it after CallTool but while another goroutine is mid-CallTool risks closing the client out from under it — by convention Close should be called only when the Server is being torn down and no further calls are in flight.

func (*Server) Identity

func (*Server) Tools

func (s *Server) Tools() []*registry.ToolDefinition

Tools is the source of truth — all four RPC shapes project from here. See git/server.go for convention notes.

Directories

Path Synopsis
cmd
docker-toolbox command
Command docker-toolbox is the standalone binary form of the codefly docker toolbox.
Command docker-toolbox is the standalone binary form of the codefly docker toolbox.

Jump to

Keyboard shortcuts

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