@SneakyThrows({ IOException.class, InterruptedException.class })
    default void copyFileToContainer(Transferable transferable, String containerPath) {
        if (getContainerId() == null) {
            throw new IllegalStateException("copyFileToContainer can only be used with created / running container");
        }

        try (
            PipedOutputStream pipedOutputStream = new PipedOutputStream();
            PipedInputStream pipedInputStream = new PipedInputStream(pipedOutputStream);
            TarArchiveOutputStream tarArchive = new TarArchiveOutputStream(pipedOutputStream)
        ) {
            Thread thread = new Thread(() -> {
                try {
                    tarArchive.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
                    tarArchive.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);

                    transferable.transferTo(tarArchive, containerPath);
                } finally {
                    IOUtils.closeQuietly(tarArchive);
                }
            });

            thread.start();

            getDockerClient()
                .copyArchiveToContainerCmd(getContainerId())
                .withTarInputStream(pipedInputStream)
                .withRemotePath("/")
                .exec();

            thread.join();
        }
    }
Copies a file to the container.

@param transferable file which is copied into the container
@param containerPath destination path inside the container
core/src/main/java/org/testcontainers/containers/ContainerState.java