private String extractClassPathResourceToTempLocation(final String hostPath) {
        File tmpLocation = createTempDirectory();
        //noinspection ResultOfMethodCallIgnored
        tmpLocation.delete();

        String urldecodedJarPath = unencodeResourceURIToFilePath(hostPath);
        String internalPath = hostPath.replaceAll("[^!]*!/", "");

        try (JarFile jarFile = new JarFile(urldecodedJarPath)) {
            Enumeration<JarEntry> entries = jarFile.entries();

            while (entries.hasMoreElements()) {
                JarEntry entry = entries.nextElement();
                final String name = entry.getName();
                if (name.startsWith(internalPath)) {
                    log.debug(
                        "Copying classpath resource(s) from {} to {} to permit Docker to bind",
                        hostPath,
                        tmpLocation
                    );
                    copyFromJarToLocation(jarFile, entry, internalPath, tmpLocation);
                }
            }
        } catch (IOException e) {
            throw new IllegalStateException(
                "Failed to process JAR file when extracting classpath resource: " + hostPath,
                e
            );
        }

        // Mark temporary files/dirs for deletion at JVM shutdown
        deleteOnExit(tmpLocation.toPath());

        try {
            return tmpLocation.getCanonicalPath();
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
    }
Extract a file or directory tree from a JAR file to a temporary location.
This allows Docker to mount classpath resources as files.

@param hostPath the path on the host, expected to be of the format 'file:/path/to/some.jar!/classpath/path/to/resource'
@return the path of the temporary file/directory
core/src/main/java/org/testcontainers/utility/MountableFile.java