amir20/dozzle · error

host not found

Error message

host %s not found

What it means

`MultiHostService.FindContainer` looks up a Docker client for the given host ID via the ClientManager. If no client is registered under that host ID, the container lookup cannot proceed and this error is returned before any container search.

Solutions

  1. Check the host ID against the hosts listed in the Dozzle UI / /api/hosts endpoint
  2. Ensure remote agent containers are running and reachable (port 7007, TLS certs)
  3. Use the correct host identifier ('local' for the local Docker daemon or the remote host's actual ID)
  4. Restart Dozzle so it rediscovers hosts

Example fix

// before
GET /api/hosts/stale-agent-abc/containers/xyz/logs
// after
GET /api/hosts/local/containers/xyz/logs
Defensive patterns

Strategy: try-catch

Validate before calling

hosts=$(curl -s /api/hosts | jq -r '.[].id')
echo "$hosts" | grep -qx "$HOST_ID" || { echo "unknown host: $HOST_ID" >&2; exit 1; }

Try / catch

svc, err := multiHostService.FindContainer(host, id, labels)
if err != nil {
  // treat as stale host: refresh host list and retry with discovered IDs
  return retryWithDiscoveredHosts()
}

Prevention

When it happens

Trigger: API calls like /api/hosts/{host}/containers/{id}/... with a host ID that isn't in the client manager: stale host IDs after an agent disconnects, mistyped host names, or remote agent hosts that are offline/unreachable at startup.

Common situations: Bookmarked URLs referencing a removed remote host; agent containers restarted with a new host ID; frontend sending a host id from stale state while the remote agent is down.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07). Data as JSON: /api/errors/e026908b287ead21. Report an issue: GitHub.

Appendix: source

Thrown at internal/support/docker/multi_host_service.go:59

	timeout             time.Duration
	notificationManager *notification.Manager
	persister           *notification.Persister
	cloudNotifyFn       atomic.Pointer[func()]
}

func NewMultiHostService(manager ClientManager, timeout time.Duration) *MultiHostService {
	m := &MultiHostService{
		manager: manager,
		timeout: timeout,
	}

	return m
}

func (m *MultiHostService) FindContainer(host string, id string, labels container.ContainerLabels) (*container_support.ContainerService, error) {
	client, ok := m.manager.Find(host)
	if !ok {
		return nil, fmt.Errorf("host %s not found", host)
	}
	ctx, cancel := context.WithTimeout(context.Background(), m.timeout)
	defer cancel()
	container, err := client.FindContainer(ctx, id, labels)
	if err != nil {
		return nil, err
	}

	return container_support.NewContainerService(client, container), nil
}

func (m *MultiHostService) ListContainersForHost(host string, labels container.ContainerLabels) ([]container.Container, error) {
	client, ok := m.manager.Find(host)
	if !ok {
		return nil, fmt.Errorf("host %s not found", host)
	}
	ctx, cancel := context.WithTimeout(context.Background(), m.timeout)
	defer cancel()

View on GitHub (pinned to d9463cbe21)