Skip to content

Unable to run supabase test db when using docker-outside-of-docker #4523

@cwharris

Description

@cwharris

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Running supabase test db from within a devcontainer that uses docker-outside-of-docker results in the following error:

failed to resolve relative path: Rel: can't make /home/cwharris/dev/my-project/supabase/tests relative to supabase/tests

To Reproduce

I've provided a full reproducer repo here:

https://github.com/cwharris/supabase-dood-test-db

Expected behavior

Running supabase db test works from within a docker-outside-of-docker enabled devcontainer.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: Ubuntu 24.04.3 (host)
  • DevContainer: mcr.microsoft.com/vscode/devcontainers/javascript-node:20
  • Version of supabase-js: 2.62.5
  • Version of Node.js: 20.19.5

Additional context

This sounds complicated (and may very well be), but the fix may be to simply allow bypassing a path check in supabase cli.

Docker-outside-of-Docker (DooD) allows containers to interact with the host docker runtime. When using DooD, mounts must be specified using host paths, such that the host docker runtime can find the paths to mount - DooD does not translate container-local paths to host-local paths, in part because the paths are not guaranteed to exist on the host (could just be a file created in a random dir in the container).

To facilitate making this work properly, the usual solution is to pass an environment variable in to the container set to ${localWorkspaceFolder}, which is the host-local path of the workspace directory mounted in to the devcontainer. From there, any new containers launched from within the devcontainer must prefix the workspace-relative paths with the host-local path assigned to ${localWorkspaceFolder}.

This works well, and I have used it reliably while working on @rapidsai.

It's a little opaque to set up, though, so I may simply have the paths wrong and need some introspection as to the directories supabase test db is expecting (though the error produced suggests the supabase cli may simple not support this use case and may be over-constraining path checks for better UX).

docker-outside-of-docker is useful in part because it uses the Host's image cache while still allowing docker usage from within a containerized development environment.

Workaround

Use docker-in-docker instead of docker-outside-of-docker and accept that recreating the development container destroys the docker image cache and will require re-downloading all Supabase images. Possibly mount /var/lib/docker in the devcontainer as a volume such that each instance of the devcontainer has it's own docker cache persisted between rebuilds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions