private String applyBuildArgsToImageName(String imageName) {
        for (Map.Entry<String, String> entry : buildArgs.entrySet()) {
            String value = Matcher.quoteReplacement(entry.getValue());
            // handle: $VARIABLE case
            imageName = imageName.replace("$" + entry.getKey(), value);
            // handle ${VARIABLE} case
            imageName = imageName.replace("${" + entry.getKey() + "}", value);
        }
        return imageName;
    }
See {@code filterForEnvironmentVars()} in {@link com.github.dockerjava.core.dockerfile.DockerfileStatement}.
core/src/main/java/org/testcontainers/images/builder/ImageFromDockerfile.java