openwrt / luci

LuCI - OpenWrt Configuration Interface
Apache License 2.0
6.34k stars 2.52k forks source link

luci-app-dockerman: containers page error by missing RepoDigests #7144

Open xiaoyao9184 opened 4 months ago

xiaoyao9184 commented 4 months ago

Some container images do not have tags causing errors, such as development containers

Steps to reproduce:

Example: Replace the following lines and remove this

  1. go to: Docker → Containers settings tab

Actual behavior:

Runtime error
Unhandled exception during request dispatching
/usr/lib/lua/luci/ucodebridge.lua:23: /usr/lib/lua/luci/model/cbi/dockerman/containers.lua:80: attempt to index field '?' (a nil value)

In error(), file [C]
called from function [anonymous function] (/usr/lib/lua/luci/ucodebridge.lua:23)
called from function ((tail call))
In [anonymous function](), file /usr/share/ucode/luci/runtime.uc, line 148, byte 45:
  called from function [arrow function] (/usr/share/ucode/luci/dispatcher.uc:794:4)
  called from function render ([C])
  called from function render_action (/usr/share/ucode/luci/dispatcher.uc:768:24)
  called from function run_action (/usr/share/ucode/luci/dispatcher.uc:795:4)
  called from function [anonymous function] (/usr/share/ucode/luci/dispatcher.uc:1003:48)
  called from anonymous function (/www/cgi-bin/luci:39:13)

 `        return lcall.call(modname, method, ...args);`
  Near here ----------------------------------------^

the error code

https://github.com/openwrt/luci/blob/b22ab2321f65d99b96ad7d4c4463ea8d70aec580/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/containers.lua#L80-L80

Expected behavior:

It looks like someone has already fixed the problem in the fork library.

https://github.com/coolsnowwolf/luci/pull/270/commits/d20cb98713321780ffededf240ea60ba605d4043#diff-e0640041aa036c0b678250bcc54848c9ba651785e2ebbf6b9432ad45520dc24bL89

https://github.com/coolsnowwolf/luci/blob/aed573a82aef60bc2bf1c74a5488ee78bc56962c/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/containers.lua#L88-L88

Additional Information:

cat /etc/openwrt_release

DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='23.05.2'
DISTRIB_REVISION='r23630-842932a63d'
DISTRIB_TARGET='x86/64'
DISTRIB_ARCH='x86_64'
DISTRIB_DESCRIPTION='OpenWrt 23.05.2 r23630-842932a63d'
DISTRIB_TAINTS=''

docker info

Client:
 Version:    25.0.3
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc.)
    Version:  v2.18.1
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 8
  Running: 5
  Paused: 0
  Stopped: 3
 Images: 188
 Server Version: 25.0.3
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version:
 runc version:
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.137
 Operating System: OpenWrt 23.05.2
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 15.4GiB
 Name: R86S
 ID: c30c4861-f099-4abe-86ef-036dd3045542
 Docker Root Dir: /mnt/nvme/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: API is accessible on http://0.0.0.0:2375 without encryption.
         Access to the remote API is equivalent to root access on the host. Refer
         to the 'Docker daemon attack surface' section in the documentation for
         more information: [Docker security](https://docs.docker.com/go/attack-surface/)
WARNING: No swap limit support

docker container ls --format json

{
    "Command": "\"/bin/sh -c 'chmod -…\"",
    "CreatedAt": "2024-04-30 06:56:20 +0000 UTC",
    "ID": "6b2c48c4ddbf",
    "Image": "c399848e293c",
    "Labels": "dev.containers.source=https://github.com/devcontainers/images,dev.containers.timestamp=Tue, 05 Mar 2024 17:55:46 GMT,dev.containers.variant=bullseye,devcontainer.metadata=[ {\"id\":\"ghcr.io/devcontainers/features/common-utils:2\"}, {\"id\":\"ghcr.io/devcontainers/features/git:1\"}, {\"remoteUser\":\"vscode\"} ],version=1.0.9,dev.containers.id=base-debian,dev.containers.release=v0.3.32",
    "LocalVolumes": "0",
    "Mounts": "",
    "Names": "zealous_curran",
    "Networks": "bridge",
    "Ports": "",
    "RunningFor": "4 weeks ago",
    "Size": "0B",
    "State": "exited",
    "Status": "Exited (1) 4 weeks ago"
}
{
    "Command": "\"/bin/sh -c 'chmod -…\"",
    "CreatedAt": "2024-04-30 06:47:13 +0000 UTC",
    "ID": "4b64a2fd8b81",
    "Image": "c399848e293c",
    "Labels": "dev.containers.release=v0.3.32,dev.containers.source=https://github.com/devcontainers/images,dev.containers.timestamp=Tue, 05 Mar 2024 17:55:46 GMT,dev.containers.variant=bullseye,devcontainer.metadata=[ {\"id\":\"ghcr.io/devcontainers/features/common-utils:2\"}, {\"id\":\"ghcr.io/devcontainers/features/git:1\"}, {\"remoteUser\":\"vscode\"} ],version=1.0.9,dev.containers.id=base-debian",
    "LocalVolumes": "0",
    "Mounts": "",
    "Names": "inspiring_chatterjee",
    "Networks": "bridge",
    "Ports": "",
    "RunningFor": "4 weeks ago",
    "Size": "0B",
    "State": "exited",
    "Status": "Exited (1) 4 weeks ago"
}
stokito commented 1 week ago

It would be great if you create a PR for this.