Skip to content

Commit

Permalink
don’t claim dockerhost when we don’t run inside docker
Browse files Browse the repository at this point in the history
  • Loading branch information
ndeloof committed Sep 18, 2015
1 parent 1feb17d commit c226479
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import hudson.maven.TcpSocketHostLocator;

import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;

/**
* @author <a href="mailto:[email protected]">Nicolas De Loof</a>
Expand All @@ -13,6 +16,11 @@ public class MavenPluginHelper extends TcpSocketHostLocator {

@Override
public String getTcpSocketHost() throws IOException {
return "dockerhost";
try {
InetAddress.getByName("dockerhost");
return "dockerhost";
} catch (UnknownHostException e) {
// we are not running inside a Docker container;
}
}
}

0 comments on commit c226479

Please sign in to comment.