Skip to content

Unable to download images locally when mapping image directory to external folder. #444

@cecoates

Description

@cecoates

I am running Wallabag in Portainer using Docker Compose.

Wallabag Docker Image version: 2.6.13

If you do not map the image directory to an external folder, like this:

services:
  wallabag:
    image: wallabag/wallabag
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=wallaroot
      - SYMFONY__ENV__DATABASE_DRIVER=pdo_mysql
      - SYMFONY__ENV__DATABASE_HOST=wallabagdb
      - SYMFONY__ENV__DATABASE_PORT=3306
      - SYMFONY__ENV__DATABASE_NAME=wallabag
      - SYMFONY__ENV__DATABASE_USER=wallabag
      - SYMFONY__ENV__DATABASE_PASSWORD=wallapass
      - SYMFONY__ENV__DATABASE_CHARSET=utf8mb4
      - SYMFONY__ENV__DATABASE_TABLE_PREFIX="wallabag_"
      - SYMFONY__ENV__MAILER_DSN=smtp://127.0.0.1
      - SYMFONY__ENV__FROM_EMAIL=wallabag@example.com
      - SYMFONY__ENV__DOMAIN_NAME=http://192.168.10.50:2081
      - SYMFONY__ENV__SERVER_NAME="Wallabag453"
    ports:
      - "2081:80"
    depends_on:
      wallabagdb:
        condition: service_healthy
      wallabagredis:
        condition: service_healthy
  wallabagdb:
    image: mariadb
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=wallaroot
    volumes:
      - /share/Portainer/Wallabag/data:/var/lib/mysql
    healthcheck:
      test: ["CMD", "/usr/local/bin/healthcheck.sh", "--innodb_initialized"]
      interval: 20s
      timeout: 3s
  wallabagredis:
    image: redis:alpine
    restart: unless-stopped   
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 20s
      timeout: 3s

Downloading images locally works fine.

However, if you map the image directory to an external folder (because you want that data to be persistent), it seems to create the folder as root and you run into permissions issues.

services:
  wallabag:
    image: wallabag/wallabag
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=wallaroot
      - SYMFONY__ENV__DATABASE_DRIVER=pdo_mysql
      - SYMFONY__ENV__DATABASE_HOST=wallabagdb
      - SYMFONY__ENV__DATABASE_PORT=3306
      - SYMFONY__ENV__DATABASE_NAME=wallabag
      - SYMFONY__ENV__DATABASE_USER=wallabag
      - SYMFONY__ENV__DATABASE_PASSWORD=wallapass
      - SYMFONY__ENV__DATABASE_CHARSET=utf8mb4
      - SYMFONY__ENV__DATABASE_TABLE_PREFIX="wallabag_"
      - SYMFONY__ENV__MAILER_DSN=smtp://127.0.0.1
      - SYMFONY__ENV__FROM_EMAIL=wallabag@example.com
      - SYMFONY__ENV__DOMAIN_NAME=http://192.168.10.50:2081
      - SYMFONY__ENV__SERVER_NAME="Wallabag453"
    ports:
      - "2081:80"
    volumes:
      - /share/Portainer/Wallabag/images:/var/www/wallabag/web/assets/images
    depends_on:
      wallabagdb:
        condition: service_healthy
      wallabagredis:
        condition: service_healthy
  wallabagdb:
    image: mariadb
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=wallaroot
    volumes:
      - /share/Portainer/Wallabag/data:/var/lib/mysql
    healthcheck:
      test: ["CMD", "/usr/local/bin/healthcheck.sh", "--innodb_initialized"]
      interval: 20s
      timeout: 3s
  wallabagredis:
    image: redis:alpine
    restart: unless-stopped   
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 20s
      timeout: 3s

The folder is owned by root:

downloadimages-folderisroot.txt

Trying to download images results in permission errors:

downloadimages-folderisroot-downloaderrors.txt

If you chmod 777 the folder:

downloadimages-folderis777.txt

It still results in download errors:

downloadimages-folderis777-downloaderrors.txt

And the image folder is still empty:

downloadimages-folderis777-emptydirectory.txt

I saw in another issue that someone changed the owner to nobody, so I tried that next. It still results in permission errors:

downloadimages-folderisnobody-downloaderrors.txt

However, the files did download. You can see them:

downloadimages-folderisnobody-imagesdownloaded.txt

But you can still see the errors when you try to download images, and they don't display on the article. You also can't view the image file directly, you get a "Not route found" error in your browser.

Image

Image

I know similar issues have been closed attributing it to permission issues, but I think this seems to be Docker specific. Changing the permissions on the folder to 777 and owned by nobody still results in errors and the images not displaying (although they do seemed to download, and I can view them in the folder mapped via volumes.)

If you disable downloading images locally, everything else seems to work as expected as far as I can tell.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions