title: Java + ChromeDriver + Docker: CreatePlatformSocket() failed: Address family not supported by protocol (97)
body: <p>I have a Java application using selenium and ChromeDriver to test some applications, say, app A, B and C.</p>
  
  <p>My local environment works fine both in visual and headless mode (Chrome version 66.0.3359.139 64 bits) and it takes 5 seconds to test each application.</p>
  
  <p>When running headless in a jenkins docker node (Chrome version 71), app A and C logs:</p>
  
  <blockquote>
    <p>Starting ChromeDriver 2.46.628388 on port 15981</p>
    
    <p>Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.</p>
    
    <p>[SEVERE]: CreatePlatformSocket() failed: Address
    family not supported by protocol (97)</p>
    
    <p>org.openqa.selenium.remote.ProtocolHandshake createSession INFO:
    Detected dialect: OSS</p>
  </blockquote>
  
  <p>But runs all tests fine.</p>
  
  <p>App B, on the other hand, logs:</p>
  
  <blockquote>
    <p>Starting ChromeDriver 2.46.628388 on port 15981</p>
    
    <p>Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.</p>
    
    <p>[SEVERE]: CreatePlatformSocket() failed: Address
    family not supported by protocol (97)</p>
    
    <p>[SEVERE]: CreatePlatformSocket() failed: Address
    family not supported by protocol (97)</p>
    
    <p>org.openqa.selenium.remote.ProtocolHandshake createSession INFO:
    Detected dialect: OSS</p>
  </blockquote>
  
  <p>And "hangs" for some 15 minutes before continuing.</p>
  
  <p>This is how I configure the driver:</p>
  
  <pre class="lang-java prettyprint-override"><code>    private static WebDriver createChromeDriver() {
          System.setProperty("webdriver.chrome.driver", DRIVER_PATH);
          ChromeOptions options = new ChromeOptions();
          if (ENABLE_HEADLESS) {
              options.addArguments("--headless");
              options.addArguments("--no-sandbox");
              options.addArguments("--disable-web-security");
              options.addArguments("--no-first-run");
              options.addArguments("--no-check-default-driver");
              options.addArguments("--allow-running-insecure-content");
              options.addArguments("--disable-infobars");
              options.addArguments("--start-maximized");
              options.addArguments("--ignore-certificate-errors");
              options.addArguments("--disable-popup-blocking");
              options.addArguments("--disable-notifications");
              options.setExperimentalOption("prefs", singletonMap("profile.default_content_settings.geolocation", 2));
          }
          options.setExperimentalOption("useAutomationExtension", false);
  
          ChromeDriver chromeDriver = new ChromeDriver(options);
          chromeDriver.manage().window().maximize();
          return chromeDriver;
      }
  </code></pre>
  
  <p>I tried just with "--headless", but I had the same problem.</p>