Skip to content

[Feature Request] Support copying files *from* a running container to the host #867

@DCjanus

Description

@DCjanus

Summary

Currently testcontainers provides CopyToContainer for transferring files into a container, but there is no corresponding API to copy files from a running container back to the host.
This feature would align the Rust implementation with the Java version, which already supports this behavior.

Motivation

In many integration tests, it’s useful to retrieve generated artifacts, logs, or configuration files from inside a container after execution.
At the moment, users need to manually use bollard::Docker::download_from_container as a workaround.

Reference

The Java implementation offers similar functionality:
https://java.testcontainers.org/features/files/

Proposal

Add an API such as CopyFromContainer, allowing users to copy files or directories from a container path to a host path.
This could leverage the existing bollard client already exposed in recent versions.

Notes

I'm happy to contribute this feature when time allows, and would also welcome anyone else who needs this to pick it up.

Thanks for maintaining this excellent project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions