amir20 / dozzle

Realtime log viewer for docker containers.
https://dozzle.dev/
MIT License
5.95k stars 299 forks source link

crash (*Client).ListContainers(0xc00022ce20) #2386

Closed aissat closed 1 year ago

aissat commented 1 year ago

Describe the bug (*Client).ListContainers(0xc00022ce20)

dozzle logs:

goroutine 1 [running]:
github.com/amir20/dozzle/docker.(*Client).ListContainers(0xc00022ce20)
    /dozzle/docker/client.go:163 +0x505
main.createLocalClient({{0x8c9eef, 0x5}, {0x894e51, 0x1}, {0x0, 0x0}, {0x8ac39d, 0x4}, {0x0, 0x0}, ...}, ...)
    /dozzle/main.go:208 +0xbf
main.createClients({{0x8c9eef, 0x5}, {0x894e51, 0x1}, {0x0, 0x0}, {0x8ac39d, 0x4}, {0x0, 0x0}, ...}, ...)
    /dozzle/main.go:138 +0x65
main.main()
    /dozzle/main.go:76 +0x166
level=info msg="Dozzle version v4.11.4"

Server: Docker Engine - Community Engine: Version: 20.10.18 API version: 1.41 (minimum version 1.12) Go version: go1.18.6 Git commit: e42327a Built: Thu Sep 8 23:10:02 2022 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.8 GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6 runc: Version: 1.1.4 GitCommit: v1.1.4-0-g5fd4c4d docker-init: Version: 0.19.0 GitCommit: de40ad0

amir20 commented 1 year ago

Interesting, I have never seen this problem, but I know what's happening. This error is happening when Dozzle is fetching the container name. It looks like in your case you don't have any names for your container. Is that true? Can you check with docker ps. Is there a container with no name?

I can have a fix, but I wonder how that could happen. Docker should assign a name to all containers. So I am not sure how this could happen.

aissat commented 1 year ago

Interesting, I have never seen this problem, but I know what's happening. This error is happening when Dozzle is fetching the container name. It looks like in your case you don't have any names for your container. Is that true? Can you check with docker ps. Is there a container with no name?

I can have a fix, but I wonder how that could happen. Docker should assign a name to all containers. So I am not sure how this could happen.

Hi @amir20 , i checked all containers has a name

# docker ps |wc -w
75
#  docker ps --format '{{.Names}}' | wc -w
75
# docker ps --format '{{printf "%.4s" .Names}}' | column -c 40 
dzl asm log dev khu
pro asm fid dev khu
pro asm fid drc lwz
akt asm fid bus lwz
akt col akt bus lwz
akt col akt bus lwz
mai dev akt bus lwz
rab log eco drc dev
mai fid eco pro dev
red fid eco sta dev
wed fid eco web dev
col dev eco dev mai
col sta lwz dev red
doc sta lwz dev sma
asm log lwz sav dev

image

amir20 commented 1 year ago

Yea, according to that everything should work.

I created a patch at #2387 where it checks to see if name exists otherwise uses "no name". Can you try amir20/dozzle:pr-2387 and see if it works? If you see a running container in Dozzle with no name then that's the culprit.

Thanks!

aissat commented 1 year ago

Yea, according to that everything should work.

I created a patch at #2387 where it checks to see if name exists otherwise uses "no name". Can you try amir20/dozzle:pr-2387 and see if it works? If you see a running container in Dozzle with no name then that's the culprit.

Thanks!

@amir20 thanks, now working well :100:

amir20 commented 1 year ago

Alright, I'll merge it today and release.

aissat commented 1 year ago

You are right if found no name container id f698f35d63d6 image

amir20 commented 1 year ago

Based on the random sha, looks like a random container dangling.

amir20 commented 1 year ago

Releasing 4.11.5