private boolean weShouldSkipDockerBuild() {
    if (skipDockerBuild) {
      getLog().info("Property skipDockerBuild is set");
      return true;
    }

    final String packaging = session.getCurrentProject().getPackaging();
    if ("pom".equalsIgnoreCase(packaging)) {
      getLog().info("Project packaging is " + packaging);
      return true;
    }

    if (dockerDirectory != null) {
      final Path path = Paths.get(dockerDirectory, "Dockerfile");
      if (!path.toFile().exists()) {
        getLog().info("No Dockerfile in dockerDirectory");
        return true;
      }
    }

    return false;
  }
Set the networking mode for the RUN instructions during build
src/main/java/com/spotify/docker/BuildMojo.java