slimtoolkit/slim · error

no docker info

Error message

no docker info

What it means

ErrNoDockerInfo is returned by the dockerclient constructors and command handlers (NewInteractiveApp, OnCommand, OnCopyCommand, OnImageIndexCreateCommand) when no Docker connection information can be derived from the environment. The client looks for standard DOCKER_* environment variables (host, TLS settings, API version, cert path) or the default Docker socket and fails when none are present.

Source

Thrown at pkg/docker/dockerclient/client.go:36

const (
	EnvDockerAPIVer      = "DOCKER_API_VERSION"
	EnvDockerHost        = "DOCKER_HOST"
	EnvDockerTLSVerify   = "DOCKER_TLS_VERIFY"
	EnvDockerCertPath    = "DOCKER_CERT_PATH"
	UnixSocketPath       = "/var/run/docker.sock"
	UnixSocketAddr       = "unix:///var/run/docker.sock"
	unixUserSocketSuffix = ".docker/run/docker.sock"
)

var EnvVarNames = []string{
	EnvDockerHost,
	EnvDockerTLSVerify,
	EnvDockerCertPath,
	EnvDockerAPIVer,
}

var (
	ErrNoDockerInfo = errors.New("no docker info")
)

func UserDockerSocket() string {
	home, _ := os.UserHomeDir()
	return filepath.Join(home, unixUserSocketSuffix)
}

type SocketInfo struct {
	Address       string `json:"address"`
	FilePath      string `json:"file_path"`
	FileType      string `json:"type"`
	FilePerms     string `json:"perms"`
	SymlinkTarget string `json:"symlink_target,omitempty"`
	TargetPerms   string `json:"target_perms,omitempty"`
	TargetType    string `json:"target_type,omitempty"`
	CanRead       bool   `json:"can_read"`
	CanWrite      bool   `json:"can_write"`
}

View on GitHub (pinned to 81940d17fa)

Solutions

  1. Set DOCKER_HOST (e.g., unix:///var/run/docker.sock or tcp://host:2375) before running
  2. Install/start the Docker daemon or Docker Desktop so the default socket exists
  3. Mount the Docker socket into the container: -v /var/run/docker.sock:/var/run/docker.sock
  4. If using TLS, set DOCKER_TLS_VERIFY, DOCKER_CERT_PATH, and DOCKER_API_VER together
  5. Re-run without sudo or with 'sudo -E' so DOCKER_* vars are preserved

Example fix

// before
client, err := dockerclient.New() // no env info
// after
os.Setenv("DOCKER_HOST", "unix:///var/run/docker.sock")
client, err := dockerclient.New()
Defensive patterns

Strategy: validation

Validate before calling

// Go: verify Docker connection info exists before creating a client
hasInfo := os.Getenv("DOCKER_HOST") != "" ||
    func() bool { _, err := os.Stat("/var/run/docker.sock"); return err == nil }()
if !hasInfo {
    return dockerclient.ErrNoDockerInfo // or surface a clear message
}

Type guard

func IsNoDockerInfo(err error) bool {
    return errors.Is(err, dockerclient.ErrNoDockerInfo)
}

Try / catch

if err != nil {
    if errors.Is(err, dockerclient.ErrNoDockerInfo) {
        // prompt user to set DOCKER_HOST or start the Docker daemon
    }
    return err
}

Prevention

When it happens

Trigger: Calling any dockerclient command/constructor without DOCKER_HOST set and without /var/run/docker.sock present; environment missing EnvDockerHost/EnvDockerTLSVerify/EnvDockerCertPath/EnvDockerAPIVer variables.

Common situations: Running the tool outside a Docker context (no Docker Desktop/daemon installed); CI containers without the Docker socket mounted; env vars stripped when sudo is used; DOCKER_HOST pointing to a removed context so no info remains.

Related errors


AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31). Data as JSON: /api/errors/a8492c9d4467cbfb. Report an issue: GitHub.