File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 1414RYUK_DISABLED : bool  =  environ .get ("TESTCONTAINERS_RYUK_DISABLED" , "false" ) ==  "true" 
1515RYUK_DOCKER_SOCKET : str  =  environ .get ("TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE" , "/var/run/docker.sock" )
1616RYUK_RECONNECTION_TIMEOUT : str  =  environ .get ("RYUK_RECONNECTION_TIMEOUT" , "10s" )
17+ TC_HOST_OVERRIDE : Optional [str ] =  environ .get ("TC_HOST" , environ .get ("TESTCONTAINERS_HOST_OVERRIDE" ))
1718
1819TC_FILE  =  ".testcontainers.properties" 
1920TC_GLOBAL  =  Path .home () /  TC_FILE 
@@ -52,6 +53,11 @@ class TestcontainersConfiguration:
5253    ryuk_reconnection_timeout : str  =  RYUK_RECONNECTION_TIMEOUT 
5354    tc_properties : dict [str , str ] =  field (default_factory = read_tc_properties )
5455    _docker_auth_config : Optional [str ] =  field (default_factory = lambda : environ .get ("DOCKER_AUTH_CONFIG" ))
56+     tc_host_override : Optional [str ] =  TC_HOST_OVERRIDE 
57+     """ 
58+     https://github.com/testcontainers/testcontainers-go/blob/dd76d1e39c654433a3d80429690d07abcec04424/docker.go#L644 
59+     if os env TC_HOST is set, use it 
60+     """ 
5561
5662    @property  
5763    def  docker_auth_config (self ):
Original file line number Diff line number Diff line change @@ -187,18 +187,14 @@ def host(self) -> str:
187187        """ 
188188        Get the hostname or ip address of the docker host. 
189189        """ 
190-         # https://github.com/testcontainers/testcontainers-go/blob/dd76d1e39c654433a3d80429690d07abcec04424/docker.go#L644 
191-         # if os env TC_HOST is set, use it 
192-         host  =  os .environ .get ("TC_HOST" )
193-         if  not  host :
194-             host  =  os .environ .get ("TESTCONTAINERS_HOST_OVERRIDE" )
190+         host  =  c .tc_host_override 
195191        if  host :
196192            return  host 
197193        try :
198194            url  =  urllib .parse .urlparse (self .client .api .base_url )
199195
200196        except  ValueError :
201-             return  None 
197+             return  "localhost" 
202198        if  "http"  in  url .scheme  or  "tcp"  in  url .scheme :
203199            return  url .hostname 
204200        if  inside_container () and  ("unix"  in  url .scheme  or  "npipe"  in  url .scheme ):
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments