upserve / docker-api

A lightweight Ruby client for the Docker Remote API
MIT License
1.09k stars 287 forks source link

Ability to read a file from the container by chunks #575

Open ianfixes opened 3 years ago

ianfixes commented 3 years ago

This function will read the contents of a file from a DockerContainer: https://github.com/swipely/docker-api/blob/a322b83e44a8e46a70a166a6c84a0b8d1080ddfe/lib/docker/container.rb#L300-L313

However, it returns them as a string. Can a variant of this be added such that (if a block is given) a function such as archive_out_stream can be used to pass the un-tarred file contents to a given block, chunk by chunk? I'm concerned that opening large files in this way will cause out-of-memory issues.