docker / docker/docker-py

Make images.build async

Open
#3,158 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

Builds take a long time and currently the Image.build function does block until the build is complete and worse, as it returns a trouble with the generator as the 2nd argument it'll also not allow to output the build log in real-time to the terminal, but only once it returned.

Improvement suggestion, add an async version of images.build

Example usage:

import docker
_client = docker.from_env()
with _client.images.build_async(path="/tmp/foo", pull=True, rm=True, quiet=False) as _builder:
  _builder.start()
  for _line in _builder.logs:
    print(_line)
  if _builder.status == "failed":
    do_something()

Functions and properties to control when the builder job is actually executed: start/stop/pause/resume/status and ".logs" as a generator for the build log with real-time updates.

Contributor guide

Open the contributing guide

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.

Research direction

Start by reading the existing images.build entry point and its Docker Engine build integration. Compare the proposed build_async context-manager usage with the current generator behavior, then define and test completion when start/stop/pause/resume/status and real-time logs work as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
api, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.