Skip to content

fix(docker): force client.DefaultDockerHost for supabase start when using colima - #5074

Closed
hk220 wants to merge 3 commits into
supabase:developfrom
hk220:support-colima
Closed

hk220 wants to merge 3 commits into
supabase:developfrom
hk220:support-colima

Conversation

@hk220

@hk220 hk220 commented Apr 13, 2026 •

Copy link
Copy Markdown

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

#5073

What is the new behavior?

Force the use of client.DefaultDockerHost when running supabase start with colima

@hk220
hk220 requested a review from a team as a code owner April 13, 2026 04:53
@hk220 hk220 changed the title fix: force client.dockerDefaultHost for supabase start when using colima fix: force client.DefaultDockerHost for supabase start when using colima Apr 13, 2026
@hk220

hk220 commented Apr 13, 2026

Copy link
Copy Markdown
Author

Sorry, I fixed the typos in this title and description.

Comment thread internal/start/start.go Outdated
strings.HasSuffix(parsed.Host, "/.docker/desktop/docker.sock") {
// Docker will not mount rootless socket directly;
strings.HasSuffix(parsed.Host, "/.docker/desktop/docker.sock") ||
strings.Contains(parsed.Host, "/.colima/") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should probably fully specify /.colima/docker.sock for parity with the docker desktop comparison.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Since Colima creates docker.sock in two locations, configure it as shown above.

% find ~/.colima -name ‘docker.sock’
/Users/hk/.colima/default/docker.sock
/Users/hk/.colima/docker.sock
%

@huffstarter

Copy link
Copy Markdown

I haven't tested this fix but am running into the same problem. The main issue is that for colima you need a bind mount for the VM's /var/run/docker.sock to /var/run/docker.sock vs trying to use the macos ~/.colima/dock.sock

(See this comment in this issue abiosoft/colima#997)

So the fix look sensible to me.

@hk220
hk220 requested a review from huffstarter April 17, 2026 23:17
@huffstarter

Copy link
Copy Markdown

@hk220 I'm not a contributor on this repo so can't really review.

@hk220 hk220 changed the title fix: force client.DefaultDockerHost for supabase start when using colima fix(docker): force client.DefaultDockerHost for supabase start when using colima Apr 18, 2026
@hk220

hk220 commented Apr 18, 2026

Copy link
Copy Markdown
Author

@huffstarter
Oops, sorry about that.

This is my first contribution, so I made a mistake.
I’ll just wait for a contributor to review this.

@github-actions

Copy link
Copy Markdown
Contributor

Hi! Thanks for contributing to Supabase CLI.

We're closing this pull request because it has not had any activity for 60 days, and we try to keep the PR queue focused on changes that are still active.

If this change is still relevant, please update it against the current develop branch and reopen it if GitHub allows, or leave a comment and a maintainer can help reopen it. You're also welcome to open a fresh PR with updated changes.

@rlirli

rlirli commented Jul 7, 2026

Copy link
Copy Markdown

Note, file has been renamed from internal/start/start.go to apps/cli-go/internal/start/start.go in source repo's default branch: https://github.com/supabase/cli/blob/develop/apps/cli-go/internal/start/start.go

@rlirli

rlirli commented Jul 7, 2026

Copy link
Copy Markdown

@hk220 I've tested your fix on current supabase/cli v2.109.1; it works 🎉

Applied the same change to apps/cli-go/internal/start/start.go (path moved since this PR), re-built binary and re-ran with SUPABASE_CLI_BINARY_OVERRIDE against a project with [analytics] enabled = true.

Steps for others to reproduce

To reproduce:

  1. Clone and check out supabase/cli develop
  2. Apply fix(docker): force client.DefaultDockerHost for supabase start when using colima #5074 patch:
# apps/cli-go/internal/start/start.go
			if dindHost, err = client.ParseHostURL(client.DefaultDockerHost); err != nil {
				return errors.Errorf("failed to parse default host: %w", err)
			} else if strings.HasSuffix(parsed.Host, "/.docker/run/docker.sock") ||
-				strings.HasSuffix(parsed.Host, "/.docker/desktop/docker.sock") {
-				// Docker will not mount rootless socket directly;
+				strings.HasSuffix(parsed.Host, "/.docker/desktop/docker.sock") ||
+				strings.HasSuffix(parsed.Host, "/.colima/default/docker.sock") ||
+				strings.HasSuffix(parsed.Host, "/.colima/docker.sock") {
+				// Docker Desktop and Colima will not mount rootless socket directly;
				// instead, specify root socket to have it handled under the hood
				binds = append(binds, fmt.Sprintf("%[1]s:%[1]s:ro", dindHost.Host))
			} else {
  1. cd apps/cli-go && go build -o ~/bin/supabase-colima .
  2. colima start (or colima start --mount-type sshfs)
  3. In project repo: export SUPABASE_CLI_BINARY_OVERRIDE="$HOME/bin/supabase-colima" && supabase start
  4. Success:
Starting containers...
Waiting for health checks...
Started supabase local development setup.

Result:
supabase start completes; supabase_vector_[projectname] is healthy; Studio Logs Explorer shows live logs. Works with both Colima mount-types, default virtiofs and --mount-type sshfs.


@hk220 Would you like to update this PR against develop and reopen, or should I open a fresh PR crediting you? Happy to co-author or defer to you either way. Many thanks! ☺️

rlirli added a commit to rlirli/supabase-cli-fork that referenced this pull request Jul 7, 2026
…acOS (fixes supabase#5073)

## What kind of change does this PR introduce?

Bug fix (docker socket bind mount for colima, macOS-only).

## What is the current behavior?

When `config.toml` defines `[analytics] enabled = true`, `supabase start` 
starts the vector container with a bind-mount derived from 
`utils.Docker.DaemonHost()`
(`apps/cli-go/internal/start/start.go`, `case "unix"`).

Docker Desktop socket paths (`~/.docker/run/docker.sock`,
`~/.docker/desktop/docker.sock`) already take a special branch: instead
of mounting the macOS-side socket directly, the CLI bind-mounts
`/var/run/docker.sock` (`client.DefaultDockerHost`) and lets Docker
handle it under the hood (same pattern as supabase#4791 / `7071ee1`).

Colima does not match that branch. With `DOCKER_HOST` pointing at
`~/.colima/default/docker.sock` (or `~/.colima/docker.sock`), the CLI
falls through to the `else` path and bind-mounts the Colima client
socket path verbatim into vector.

On macOS + Colima this breaks `supabase start` with analytics enabled:

- **default `virtiofs` mount type:** container creation fails —
  `mkdir ~/.colima/default/docker.sock: operation not supported`
- **`sshfs` mount type:** vector starts but cannot reach dockerd —
  `Listing currently running containers failed: Connection refused`

Reported in supabase#5073. Proposed fix in stale-closed supabase#5074 by @hk220; not
merged.

## What is the new behavior?

Extend the existing Docker Desktop socket workaround to Colima:

```go
strings.HasSuffix(parsed.Host, "/.colima/default/docker.sock") ||
strings.HasSuffix(parsed.Host, "/.colima/docker.sock")
```

When matched, vector bind-mounts `/var/run/docker.sock` inside the VM
(same `dindHost.Host` self-bind as Docker Desktop), not the macOS-side
Colima forwarding socket.

Validated locally on macOS 26.5.1, Colima 0.10.3, `[analytics] enabled
= true`, fresh `colima stop && colima delete` between runs — works with
both default **`virtiofs`** and **`--mount-type sshfs`**. Vector stays
healthy; Studio Logs Explorer ingests container logs.

Fixes supabase#5073
Based on supabase#5074 by @hk220

---------

Co-authored-by: kazuki <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants