Skip to content

[BUG] Docker Swarm mode not seeing images/containers #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mihakrumpestar opened this issue Mar 2, 2025 · 15 comments
Closed

[BUG] Docker Swarm mode not seeing images/containers #59

mihakrumpestar opened this issue Mar 2, 2025 · 15 comments
Labels
bug Something isn't working

Comments

@mihakrumpestar
Copy link

mihakrumpestar commented Mar 2, 2025

Describe the bug
Running this on a docker swarm mode results in Cup not seeing any images/containers.

To Reproduce

Run on Docker swarm mode with containers deployed as stacks (only sees itself when running CLI, does not see even itself when deployed as Docker Swarm stack):

docker run -tv /var/run/docker.sock:/var/run/docker.sock ghcr.io/sergi0g/cup check

Expected behavior
Works on regular docker install, list images and updates.

Screenshots
If applicable, add screenshots to help explain your problem.

System info (please complete the following information):

[admin@docker-swarm-0 ~]$ fastfetch
                  -`                     admin@docker-swarm-0
                 .o+`                    --------------------
                `ooo/                    OS: Arch Linux x86_64
               `+oooo:                Host: SY-YL B550M
              `+oooooo:             Kernel: Linux 6.8.12-1-pve

[admin@docker-swarm-0 ~]$ docker version
Client:
 Version:           28.0.0
 API version:       1.48
 Go version:        go1.24.0
 Git commit:        f9ced58158
 Built:             Mon Feb 24 21:55:48 2025
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          28.0.0
  API version:      1.48 (minimum version 1.24)
  Go version:       go1.24.0
  Git commit:       af898abe44
  Built:            Mon Feb 24 21:55:48 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v2.0.3
  GitCommit:        06b99ca80cdbfbc6cc8bd567021738c9af2b36ce.m
 runc:
  Version:          1.2.5
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Additional context
Add any other info that you think may be useful here.

@mihakrumpestar mihakrumpestar added the bug Something isn't working label Mar 2, 2025
@mihakrumpestar mihakrumpestar changed the title [BUG] <TITLE> [BUG] Docker Swarm mode not seeing images/containers Mar 2, 2025
@sergi0g
Copy link
Owner

sergi0g commented Mar 3, 2025

Hello! Thanks for opening this issue!

I haven't tested with swarm at all, but it should be working fine. I'll try to investigate as soon as I can and I'll update you.

@sergi0g
Copy link
Owner

sergi0g commented Mar 7, 2025

I tried running a local swarm with my server as manager and my PC as a worker and started a stack with 2 replicas running Cup. All images were checked normally. Honestly, I have no idea what could be going wrong. Could you please share your configuration so I can test that too?

@mihakrumpestar
Copy link
Author

mihakrumpestar commented Mar 7, 2025

I started from stretch. I pulled the image, and try to run it:

Image

I have no idea what is going on.

@mihakrumpestar
Copy link
Author

After looking in the code it seems that it hit my private Registry (which I changed after), which uses "Basic auth", but Cup seems to not support that. I did now exclude it, and it is running now.

Image

While I have much more images:

Image

@mihakrumpestar
Copy link
Author

mihakrumpestar commented Mar 7, 2025

I have also noticed that images used by swarm stack deploys are not actually by default usable by normal docker.

If you prune all whole setup and then deploy a stack, and then try to do: docker image history <some image that got deployed in stack> it will respond that the image is not available locally.

Example where the image is in docker images used only in Docker Stack from image above but not visible to regular Docker:

Image

If you then pull it (it will then use/transfer the stack image) and run the history command again it will work.

It seems that swarm stacks handle images a bit differently than regular docker compose and docker commands.

@sergi0g
Copy link
Owner

sergi0g commented Mar 7, 2025

Hello! Thanks for debugging the issue! The extra images are most likely not shown because they don't have a tag. Are you pulling by digest? I'll try to reproduce the problem you described and further debug it.

@mihakrumpestar
Copy link
Author

For Dozzle I used:

services:
  dozzle:
    image: mirror.gcr.io/amir20/dozzle:latest
    ...

All my stacks except for some exceptions all have latest.

I am not sure why they don't have a tag when inspecting them with docker images command.

@mihakrumpestar
Copy link
Author

Hello! Thanks for debugging the issue! The extra images are most likely not shown because they don't have a tag. Are you pulling by digest? I'll try to reproduce the problem you described and further debug it.

It appears you are right, Docker Swarm uses image with digest (label gets resolved to digest), so if Cup checks using label, it won't work.

Docs: https://docs.docker.com/engine/swarm/services/#specify-the-image-version-a-service-should-use

@mihakrumpestar
Copy link
Author

That also explains why docker image history ... only saw them after docker pull ... assigned a label to the image (as it didn't have it due to being pulled by docker swarm). And the Cup dashboard only shows images that I tested using docker pull.

@sergi0g
Copy link
Owner

sergi0g commented Mar 7, 2025

I need both the tag and the digest to check for an update, so I think Swarm is unsupported. I'm really sorry! I'll try to find another way to check for updates without the tag, but I doubt I'll find anything.

@mihakrumpestar
Copy link
Author

mihakrumpestar commented Mar 7, 2025

No worries, I am using Shepherd and it works.

I just really liked the Cup's UI and on-demand updates, so I wanted to test it out. Docker Swarm just has many edge cases, which effect a lot of the tooling unfortunately.

@sergi0g
Copy link
Owner

sergi0g commented Mar 13, 2025

Hey @mihakrumpestar!

I took a look into how Shepherd works and I'm going to try to add the required functionality to Cup. It should be able to check for updates to Docker Swarm images (although it won't be handling automatic updates like Shepherd, as I think that's beyond the scope of this project).

Can you please test? Grab a binary from here or use the ghcr.io/sergi0g/cup:v3.2.0-alpha.1) Docker image.

I hope it works for you!

@mihakrumpestar
Copy link
Author

mihakrumpestar commented Mar 14, 2025

Hi, I run it again using the image, and it seems to work:

Image

Thank you 🙂

@mihakrumpestar
Copy link
Author

mihakrumpestar commented Mar 14, 2025

Probably unrelated, all ghcr.io images are not being able to be checked:

Image

Image

Nevermind, I just redeployed it, and it checked them fine now.

@sergi0g
Copy link
Owner

sergi0g commented Mar 15, 2025

@mihakrumpestar I'm glad it worked for you. I'm waiting to see if #64 was caused by this. If it wasn't I'll release a new stable version and close this issue.

@sergi0g sergi0g closed this as completed Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants