Last active
          May 25, 2017 18:40 
        
      - 
      
- 
        Save smijar/2377c2e89cdd94d0dfd1d51e48884800 to your computer and use it in GitHub Desktop. 
    This gist provides a way to connect to a docker host
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # provide an alias to the host local loopback | |
| sudo ifconfig lo0 alias 172.20.123.1 | |
| # check alias | |
| ifconfig|more | |
| # ping alias from within docker | |
| docker run -it --rm busybox ping 172.20.123.1 | |
| # check that the host services are accessible from the aliased IP | |
| telnet 172.20.123.1 | |
| telnet 172.20.123.1 443 | |
| # or with hostname mapping | |
| or with hostname mapping for app config convenience | |
| docker run -it --rm --add-host=docker.local:172.16.123.1 busybox ping docker.local | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment