Feature: Stream bytes out on copy_from_container

Open Beginner friendly
#1,149 0 comments 0 reactions 0 assignees View on GitHub

@archit15singh is already working on this.

Since Nov 22, 2026.

  • #1152 by @archit15singh — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
67/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
docker, python
Domain
backend

Research direction

Start by reading the Python implementation of copy_file_from_container() and its tests; the issue does not name specific files. Check how the current Path-based copy is implemented and how nearby APIs expose streams. Done means callers can collect copied bytes without writing them to a temporary file, with tests covering the new behavior.

Written by the indexing model from the issue text.

Description

🚀 enhancement

What are you trying to do?

In Testcontainers Java, there's a handy override for copyFileFromContainer() that let's you pass a function to collect the output stream. This seems to be primarily exist so you can stream the bytes out without writing them to disk.

In Testcontainers Go, CopyFileFromContainer() returns an io.ReadCloser directly which is super nice.

It would be handy if there was a way to do this in the python version, which currently only supports passing a Path and writing to that path.

Why should it be done this way?

I don't want to use a temporary file on disk.

Other references:
https://golang.testcontainers.org/features/files_and_mounts/

https://github.com/testcontainers/testcontainers-java/blob/e16dca9ea8e8b097c7b15aa8f420cee0a1b16687/core/src/main/java/org/testcontainers/containers/ContainerState.java#L404

Dominant language
Python
Stars
2.3k
Forks
397
Avg merge
8d 16h
Merged PRs (30d)
5

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from testcontainers/testcontainers-python

All issues in testcontainers/testcontainers-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.