LooLzzz / docking-station

253 stars 4 forks source link

Issues with paperless-ngx / redis #22

Closed Eco-Gaming closed 1 month ago

Eco-Gaming commented 2 months ago

When accessing the website, no containers are shown. Before this view, there was a spinning blue circle, just like in #8.

image

From the logs, it seems to be related to the redis container in my paperless stack. logs.txt

I have the following directory layout:

/home/eco/codestuff/test
├── /home/eco/codestuff/test/compose.yaml # docking-station compose file
├── /home/eco/codestuff/test/config
│   └── /home/eco/codestuff/test/config/settings.yml # default settings
├── /home/eco/codestuff/test/data
│   └── /home/eco/codestuff/test/data/cache.db
├── /home/eco/codestuff/test/logs
│   ├── /home/eco/codestuff/test/logs/docking-station-autoupdater.log
│   └── /home/eco/codestuff/test/logs/docking-station-server.log
└── /home/eco/codestuff/test/stacks
    └── /home/eco/codestuff/test/stacks/paperless-ngx
        ├── /home/eco/codestuff/test/stacks/paperless-ngx/docker-compose.env # default settings
        └── /home/eco/codestuff/test/stacks/paperless-ngx/docker-compose.yaml # docker-compose.postgres.yml from the paperless-ngx GitHub

Here's my docking-station compose file:

services:
  docking-station:
    image: loolzzz/docking-station
    restart: unless-stopped
    # environment:
    #   - WEB_PORT=3000
    #   - SERVER_PORT=3001
    ports:
      - 3000:3000
    volumes:
      - ./config:/config
      - ./data:/data
      - ./logs:/logs
      - /var/run/docker.sock:/var/run/docker.sock
      - /etc/localtime:/etc/localtime:ro
      # you should add mount points for each containers' docker-compose file you intend on update using this tool
      # i usually put everything in a single neat folder under
      - /home/eco/codestuff/test/stacks:/home/eco/codestuff/test/stacks

And last but not least my paperless-ngx compose file (copied from here):

services:
  broker:
    image: docker.io/library/redis:7
    restart: unless-stopped
    volumes:
      - redisdata:/data

  db:
    image: docker.io/library/postgres:16
    restart: unless-stopped
    volumes:
      - pgdata:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: paperless
      POSTGRES_USER: paperless
      POSTGRES_PASSWORD: paperless

  webserver:
    image: ghcr.io/paperless-ngx/paperless-ngx:latest
    restart: unless-stopped
    depends_on:
      - db
      - broker
    ports:
      - "8000:8000"
    volumes:
      - data:/usr/src/paperless/data
      - media:/usr/src/paperless/media
      - ./export:/usr/src/paperless/export
      - ./consume:/usr/src/paperless/consume
    env_file: docker-compose.env
    environment:
      PAPERLESS_REDIS: redis://broker:6379
      PAPERLESS_DBHOST: db

volumes:
  data:
  media:
  pgdata:
  redisdata:
Eco-Gaming commented 1 month ago

I have done some more research, it appears that the docker.io/library/ part is causing issues. Unlike ie. ghcr.io images, the redis image is only named redis:

$ docker image list
REPOSITORY                              TAG          IMAGE ID       CREATED         SIZE
[...]
ghcr.io/paperless-ngx/paperless-ngx     latest       69f35b5e7cfb   3 weeks ago     1.41GB
redis                                   7            dae83f665c92   5 weeks ago     117MB
[...]

Hence, this call "fails" (returns []):

# docking-station-app/src/app/api/services/docker.py, line 124 - 126
_images = docker.image.list(
    repository_or_tag=repository_or_tag,
    filters=filters or {},
)

When running get_image('redis:7') instead of the usual get_image('docker.io/library/redis:7') in docking-station-app/src/app/api/services/docker.py line 140, I no longer get the KeyError. I don't have a sufficient development environment right now to test if that fully works, but I assume it does.

One hacky solution to this could be a simple string.replace("docker.io/library/", ""), but that seems bad. I don't know the underlying reasons for the image only being called redis, maybe there is some python_on_whales function for dealing with this.

Edit: I fixed the issue by removing the docker.io/library/ in my paperless-ngx compose file. This issue might still appear though, depending on what the docker default repo is set to.

LooLzzz commented 1 month ago

@Eco-Gaming First of all, I appreciate you took the time to look into this matter,

I think what you found is just a symptom of a different problem lying around,
Because if I just run the following commands on my local machine it runs just fine -
Docking Station is not involved here

$ regctl image digest docker.io/library/redis:7
sha256:eadf354977d428e347d93046bb1a5569d701e8deb68f090215534a99dbcb23b9
$ regctl image digest ghcr.io/paperless-ngx/paperless-ngx
sha256:217cec76128c2545872cf356694f2ffd4524cb84892d0333e654795dec255633
regctl image digest docker.io/library/postgres:16
sha256:026d0ab72b34310b68160ab9299aa1add5544e4dc3243456b94f83cb1c119c2c

Maybe it depends on the machine that runs it? That would be super weird because we're all running this off the same Docker image..


I'm closing this issue since you managed to find a workaround that works for you.
Feel free to re-open the issue if you have anything to add 👍

LooLzzz commented 1 month ago

Take a look at v0.3.0