Spotify Docker Build Host Network

202 views Asked by At

Am using spotify docker client to build docker images and at the time of building images, I want to specify network as host (--network=host is the command line equivalent) because if am not setting network type to host am having troubling downloading the python packages from the internet from inside the kubernetes container

I have tried setting network to host via DockerClient.BuildParam, but it's getting ignored and hence not working,

any idea on how can i get it work ?

    // Formulate Docker Build parameters
    DockerClient.BuildParam bp2 = DockerClient.BuildParam.create("dockerfile", "./DockerFile");
    DockerClient.BuildParam bp3 = DockerClient.BuildParam.create("network", "host");
    fqiName = fullyQualifiedImage.generateFullyQualifiedName();

    // Build Image
    logger.info("DockerBuild Parameters Set. Building image -> {}", fqiName);

    dockerClient.build(
        Paths.get(workspace.getTempDirPath()), fqiName, new DockerLoggingBuildHandler(), bp2, bp3);
0

There are 0 answers