Repository: supabase/cli

Issue #87: `supabase start` fails when launched inside a container
Created: 2021-12-01T18:45:44Z
Bug report
Describe the bug
When running Supabase inside a Docker container with a docker-host-socket to container setup (container has access to the host's Docker socket), when running supabase start, Supabase tries to bind a volume from the host into another container.
➜  opinionshift git:(feat-devcontainer) supabase start 
Error: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/workspace/opinionshift/supabase/.temp/userlist.txt" to rootfs at "/etc/pgbouncer/userlist.txt" caused: mount through procfd: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
➜  opinionshift git:(feat-devcontainer) 
Reproduction
See reproduction repository
Expected behaviour
A clear and concise description of what you expected to happen.
System information

OS: Docker container inside a Linux host

Additional context
Faulty code

  
    
      cli/internal/start/start.go
    
    
        Lines 716 to 720
      in
      59245bb
    
  
  
    

        
          
           &container.HostConfig{ 
        

        
          
           	Binds:        []string{(cwd + "/supabase/.temp/kong.yml:/var/lib/kong/kong.yml:ro")}, 
        

        
          
           	PortBindings: nat.PortMap{"8000/tcp": []nat.PortBinding{{HostPort: utils.ApiPort}}}, 
        

        
          
           	NetworkMode:  container.NetworkMode(utils.NetId), 
        

        
          
           }, 
        
    
  


and

  
    
      cli/internal/start/start.go
    
    
        Lines 676 to 683
      in
      59245bb
    
  
  
    

        
          
           &container.HostConfig{ 
        

        
          
           	Binds: []string{ 
        

        
          
           		cwd + "/supabase/.temp/pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini:ro", 
        

        
          
           		cwd + "/supabase/.temp/userlist.txt:/etc/pgbouncer/userlist.txt:ro", 
        

        
          
           	}, 
        

        
          
           	PortBindings: nat.PortMap{"5432/tcp": []nat.PortBinding{{HostPort: utils.DbPort}}}, 
        

        
          
           	NetworkMode:  container.NetworkMode(utils.NetId), 
        

        
          
           }, 
        
    
  


Possible solutions

 using volumes instead of filesystem binds (note: there might be networking issues too)
 using Docker in Docker

Checklist for PR creator

 removing filesystem bindings
 checking that sibling container-to-container communications work

Duplicate issue #1939: Issues Running `supabase start` within a devcontainer without `network_mode: "host"`
Created: 2024-02-10T02:28:50Z
Describe the bug
Unable to successfully run supabase start within a devcontainer when not using network_mode: "host"
To Reproduce
If I use the below compose.yml file from within the .devcontainer folder and run supabase start I receive the error service not healthy: [supabase_rest_langchain supabase_edge_runtime_langchain]
version: '3.8'
services:
  dev:
    container_name: dev
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ..:/workspace
    environment:
      - NVIDIA_VISIBLE_DEVICES=all
    user: vscode
    command: sleep infinity
    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia
            capabilities: [gpu]
    ports:
      - "5173:5173"

Expected behavior
If I use the below compose.yml file from within the .devcontainer folder and run supabase start everything works. I would expect to not need to use network_mode: "host".
version: '3.8'
services:
  dev:
    container_name: dev
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ..:/workspace
    environment:
      - NVIDIA_VISIBLE_DEVICES=all
    user: vscode
    command: sleep infinity
    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia
            capabilities: [gpu]
    network_mode: "host"

Additional Notes

Also due to the containers immediately being removed upon failing I am unable to get the container logs.
I was also looking for a way to assign the supabase containers created with supabase start by passing in some parameters but am unable to do so like several other people mentioned across multiple issues.

System information

Crash ID: 6c8ced45a99848e79c7d5339f7d2e74c

Closing comment (2024-03-17T20:26:54Z): Related to #87