Skip to content

Docker: Add 'log_handler'-argument to pull() #12848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2025
Merged

Conversation

bblommers
Copy link
Contributor

Motivation

Some of the images that we're downloading to support our emulation are quite large, so I've been considering a way to show more info to the user about what's happening in the background.

This PR adds an additional argument, log_handler to the docker_client.pull(..) method, allowing service developers to inspect (or log) the exact output of the pull-command.

Example invocation

For example, to stream the logs to user (probably the most common usecase for this):

def some_action():
    ...
    def _process(line: str):
        LOG.debug(line)

    docker_client.pull_image("alpine", log_handler=_process)

@bblommers bblommers added this to the Playground milestone Jul 8, 2025
@bblommers bblommers added area: docker Use Docker with LocalStack semver: patch Non-breaking changes which can be included in patch releases labels Jul 8, 2025
@bblommers bblommers marked this pull request as draft July 8, 2025 11:58
Copy link

github-actions bot commented Jul 8, 2025

Test Results - Preflight, Unit

21 854 tests  ±0   20 197 ✅ ±0   6m 55s ⏱️ +29s
     1 suites ±0    1 657 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit 5441b43. ± Comparison against base commit 655d4b2.

Copy link

github-actions bot commented Jul 8, 2025

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 42s ⏱️ +36s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 5441b43. ± Comparison against base commit 655d4b2.

Copy link

github-actions bot commented Jul 8, 2025

Test Results (amd64) - Integration, Bootstrap

    5 files      5 suites   2h 22m 22s ⏱️
5 280 tests 4 351 ✅ 929 💤 0 ❌
5 286 runs  4 351 ✅ 935 💤 0 ❌

Results for commit 5441b43.

Copy link

github-actions bot commented Jul 8, 2025

LocalStack Community integration with Pro

    2 files      2 suites   1h 45m 44s ⏱️
4 921 tests 4 145 ✅ 776 💤 0 ❌
4 923 runs  4 145 ✅ 778 💤 0 ❌

Results for commit 5441b43.

@bblommers bblommers marked this pull request as ready for review July 8, 2025 13:10
Copy link
Member

@dfangl dfangl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a reasonable change, LGTM! Thanks for adding a test right away!

@bblommers bblommers merged commit f0f8045 into master Jul 10, 2025
44 checks passed
@bblommers bblommers deleted the docker-pull-log-handler branch July 10, 2025 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docker Use Docker with LocalStack semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants