lirantal / dockly

Immersive terminal interface for managing docker containers and services

Home Page:https://lirantal.github.io/dockly/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Docker image without a digest or tag crashes the imageList.widget

saemik94 opened this issue · comments

commented

What went wrong?

Hi there
Great job you did here, I really like your tool and I already recommended dockly to serveral friends :)

I stumbled over an issue after creating some local docker images. The local built images don't have a digest or tag and this leads to a bug in the imageList.widget and then the application crashes:
local-images
Empty digest:
error1

It's on immageList.widget line 52, at this point image.RepoDigests is of type object and it's value is an empty array. So the if statement evaluates to true and the split on image.RepoDigests[0] fails and leads to the crash.

Empty tag:
error2

It's on immageList.widget line 48, at this point the if statement, to check the tag value evaluates to true. Therefore the split leads then to the crash.

Proposed solution:
immageList.widget line 52
image.RepoDigests?.length ? image.RepoDigests[0].split('@')[0] : getTag(image[2], 0),

immageList.widget line 48
const getTag = (tag, part) => tag?.length ? tag[0].split(':')[part] : 'none'

With those two changes dockly runs as smooth as always, when I build it locally. If you would like, I can also create a pull request. Either way I hope I could help a little.

Your environment setup

  • Operating System: Ubuntu 22.04.2 LTS
  • Node.js version: v19.3.0
  • Package version: dockly 3.23.0
  • Docker version: Docker version 24.0.4

@saemik94 thank you for the kind words ❤️
would indeed be great if you wanted to send over a pull request and we'll happily merge and publish a new release.

commented

The fix was successfully tested in version 3.23.1, the issue is closed.