Skip to content
This repository was archived by the owner on Jan 23, 2018. It is now read-only.
This repository was archived by the owner on Jan 23, 2018. It is now read-only.

Issue: When Docker's pulling multiple images at once, rocker creates lots of unnecessary output lines #6

@mreithub

Description

@mreithub

While collapsing multiple progress messages into one output line works well when the ID doesn't change, Docker sometimes sends interleaving progress messages for different image IDs (which rocker happily prints, one per line).

Example: Create an elasticsearch.rocker file:

{"image": "elasticsearch"}

and run rocker run elasticsearch (assuming the respective images haven't been pulled yet).

That will create roughly 100 progress lines for only ~10 different image layers.

Excerpt:

00a4d15bd3b5: Downloading [=>                                                 ] 15.93 kB/654.4 kB
702a145ad065: Downloading [===========================================>       ] 5.719 MB/6.527 MB
c6a33cf73cb3: Downloading [===========================>                       ] 49.79 kB/89.28 kB
702a145ad065: Downloading [=============================================>     ] 5.916 MB/6.527 MB
00a4d15bd3b5: Downloading [==>                                                ] 32.31 kB/654.4 kB
702a145ad065: Downloading [=============================================>     ] 5.981 MB/6.527 MB

As one can see the IDs repeat but the output lines aren't collapsed properly.

One possible implementation:

  • Keep a dict of {"id": <offset>} containing the order in which we saw each image ID (and therefore having len(dict) - dict[id] being the number of lines to go back)
  • Every time we see a new ID, add a new output line and an entry to the dict
  • When we see an ID we've encountered before, we calculate how many lines to go back and reuse that output line
  • When messages without an ID arrive, reset the dict

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions