title: Accessing host's api from inside a container
body: <p>I'm trying to make a build env with docker and i want to make this automatic. i've written a custom go binary to handle build stuff and i've built an image which has <code>the go binary</code>, <code>maven</code> and <code>java8 sdk</code> installed.</p>
  
  <p>The steps that binary does are:</p>
  
  <ul>
  <li>Clone a git repo</li>
  <li>Run build command</li>
  <li>Extract build artifacts to host. (which hasnt done yet.) </li>
  </ul>
  
  <p>I'm passing repo url as parameter to binary while running container and it does build. </p>
  
  <p>But the problem is i need those artifacts in order to run builted app.</p>
  
  <p>I know i can use <code>volumes</code>, but i dont want to use them because when build has done volumes are becoming <code>dangle</code> and it needs a job for deleting those <code>dangling volumes</code>.</p>
  
  <p>I thought i can create an api for saving files into host (that means i have to run that api inside host machine)  and my custom go binary can send files to the api and api will do the saving. </p>
  
  <p>But when it comes to calling host from inside a container i've got a problem. i'm getting <code>connection refused to port xx</code> error. </p>
  
  <p>Is there a better way to do it , or should i change my approach? </p>