public ElasticsearchContainer withPluginDir(Path pluginDir) {
        if (pluginDir == null) {
            return this;
        }

        // When we have a plugin dir, we need to mount it in the docker instance
        this.pluginDir = createVolumeDirectory(true);

        // We create the volume that will be needed for plugins
        addFileSystemBind(this.pluginDir.toString(), "/plugins", BindMode.READ_ONLY);

        logger().debug("Installing plugins from [{}]", pluginDir);
        try {
            Files.list(pluginDir).forEach(path -> {
                logger().trace("File found in [{}]: [{}]", pluginDir, path);
                if (path.toString().endsWith(".zip")) {
                    logger().debug("Copying [{}] to [{}]", path.getFileName(), this.pluginDir.toAbsolutePath().toString());
                    try {
                        Files.copy(path, this.pluginDir.resolve(path.getFileName()));
                        withPlugin("file:///tmp/plugins/" + path.getFileName());
                    } catch (IOException e) {
                        logger().error("Error while copying", e);
                    }
                }
            });
        } catch (IOException e) {
            logger().error("Error listing plugins", e);
        }
        return this;
    }
public ElasticsearchContainer withPluginDir ( Path pluginDir ) { if ( pluginDir == null ) { return this ; } this . pluginDir = createVolumeDirectory ( true ) ; addFileSystemBind ( this . pluginDir . toString ( ) , "/plugins" , BindMode . READ_ONLY ) ; logger ( ) . debug ( "Installing plugins from [{}]" , pluginDir ) ; try { Files . list ( pluginDir ) . forEach ( path -> { logger ( ) . trace ( "File found in [{}]: [{}]" , pluginDir , path ) ; if ( path . toString ( ) . endsWith ( ".zip" ) ) { logger ( ) . debug ( "Copying [{}] to [{}]" , path . getFileName ( ) , this . pluginDir . toAbsolutePath ( ) . toString ( ) ) ; try { Files . copy ( path , this . pluginDir . resolve ( path . getFileName ( ) ) ) ; withPlugin ( "file:///tmp/plugins/" + path . getFileName ( ) ) ; } catch ( IOException e ) { logger ( ) . error ( "Error while copying" , e ) ; } } } ) ; } catch ( IOException e ) { logger ( ) . error ( "Error listing plugins" , e ) ; } return this ; }
Path to plugin dir which contains plugins that needs to be installed
@param pluginDir plugins dir
@return this