Crosstalk-Solutions/project-nomad · warning

Warning during container cleanup. Check server logs for deta

Error message

Warning during container cleanup. Check server logs for details.

What it means

During forceReinstall, the Docker container cleanup step (stop/remove existing container) is wrapped in a catch that logs the underlying error and broadcasts a cleanup-warning event to connected clients instead of failing the reinstall. It is intentionally non-fatal: the install proceeds after the warning. The real Docker error (e.g. container already removed, permission denied, Docker daemon unreachable) is in the logged { err } object.

Source

Thrown at admin/app/services/docker_service.ts:415

              }
            })
          }

          // Step 2: Remove the container
          this._broadcast(serviceName, 'removing', `Removing container...`)
          await dockerContainer.remove({ force: true }).catch((error) => {
            logger.warn(`Error removing container: ${error.message}`)
          })
        } else {
          this._broadcast(
            serviceName,
            'no-container',
            `No existing container found, proceeding with installation...`
          )
        }
      } catch (error: any) {
        logger.warn({ err: error }, `[DockerService] Error during container cleanup for ${serviceName}`)
        this._broadcast(serviceName, 'cleanup-warning', 'Warning during container cleanup. Check server logs for details.')
      }

      // Step 3: Clear volumes/data if needed
      try {
        this._broadcast(serviceName, 'clearing-volumes', `Checking for volumes to clear...`)
        const volumes = await this.docker.listVolumes()
        const serviceVolumes =
          volumes.Volumes?.filter(
            (v) =>
              v.Name === serviceName ||
              v.Name.startsWith(`${serviceName}_`) ||
              v.Labels?.service === serviceName
          ) || []

        for (const vol of serviceVolumes) {
          try {
            const volume = this.docker.getVolume(vol.Name)
            await volume.remove({ force: true })

View on GitHub (pinned to 0bd1c6f4f9)

Solutions

  1. Check server logs for [DockerService] Error during container cleanup to see the Docker error
  2. Manually remove the stale container: docker rm -f <service-container>, then retry force-reinstall
  3. Verify Docker daemon is running and the admin service can reach it (permissions/socket)
  4. If it recurs, restart the Docker daemon before reinstalling

Example fix

// before
// rely on forceReinstall to clean up
// after
await exec('docker rm -f my-service-container') // pre-clean stale container
await adminApi.forceReinstall('my-service')
Defensive patterns

Strategy: fallback

Validate before calling

// Before force-reinstall, pre-clean the container yourself
const exists = await exec(`docker ps -aq -f name=^/${containerName}$`)
if (exists.stdout.trim()) {
  await exec(`docker rm -f ${containerName}`)
}
await adminApi.forceReinstall(service)

Type guard

const isCleanupWarning = (evt: { event?: string }): boolean =>
  evt.event === 'cleanup-warning'

// in the SSE/ws stream handler:
if (isCleanupWarning(msg)) showBanner('Warning: container cleanup issue, check logs', 'warn')

Prevention

When it happens

Trigger: POST force-reinstall for a service whose container is in a weird state (already removed, restarting, paused), when the Docker daemon socket is inaccessible, or when the runtime user lacks permission to remove the container. Also fires on races where another process removed the container concurrently.

Common situations: User not in the docker group or wrong DOCKER_HOST; container name collision from a previous partial install; Docker daemon restarting mid-operation; Portainer/Compose managing the same container causing removal conflicts.

Related errors


AI-assisted analysis of Crosstalk-Solutions/project-nomad@0bd1c6f4f9 (2026-08-27). Data as JSON: /api/errors/140ca6877f086956. Report an issue: GitHub.