Docker issue with latest version

I upgrade to the latest docker version (29) but when I try to access nextcloud I get “update needed”.
I tried to command line update but it falis (permission denied on db)
What I can do? please help

Please provide more specific details. We can’t help you without them - e.g.

  • Which Docker image?
  • Your Docker Compose file
  • Precisely how you attempted upgraded the image

here’s my docker compose:

version: '3'

services:
  nextcloud:
    build: ./app
    image: nextcloud
    container_name: nextcloud
    restart: always
    networks: 
      - cloud
    ports:
      - 8081:80
    depends_on:
      - nextclouddb
      - redis
    volumes:
      - /home/mebitek/nextcloud/html:/var/www/html
      - /home/mebitek/nextcloud/custom_apps:/var/www/html/custom_apps
      - /home/mebitek/nextcloud/config:/var/www/html/config
      - /home/mebitek/nextcloud/data:/var/www/html/data
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Rome
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=${MYSQL_USER}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_HOST=nextclouddb
      - REDIS_HOST=redis
    devices: # import drivers for HW accel
      - /dev/dri/card0:/dev/dri/card0
      - /dev/dri/renderD128:/dev/dri/renderD128
    healthcheck:
      test: ["CMD-SHELL", "curl -Ss http://localhost/status.php | grep '\"installed\":true' || exit 1"]
      interval: 2m
      retries: 10
      start_period: 10m
      timeout: 5s

  nextclouddb:
    image: mariadb:lts
    container_name: nextcloud-db
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    networks: 
      - cloud
    volumes:
      - /home/mebitek/nextcloud/nextclouddb:/var/lib/mysql
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Rome
      - MYSQL_RANDOM_ROOT_PASSWORD=true
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=${MYSQL_USER}
      
  redis:
    image: redis:alpine
    container_name: redis
    restart: always
    volumes:
      - /home/mebitek/nextcloud/redis:/data  
    networks: 
      - cloud

networks:
  cloud:
    name: cloud
    driver: bridge

I usually update with docker-compose pull && docker-compose up -d

it sounds more or less like the installation or upgrade failed in the middle. If this is the case instructions how to recover from “upgrade over multiple versions” could be useful.

consult container logs:

# logs from specific container
docker logs {app container}
docker compose logs {app container}
# logs from all container in the current compose
docker compose logs

executing commands from the command line requires user name e.g.

docker exec --user www-data {app container} php occ ...
docker compose exec --user 33 {app container} php occ ...

I’m not aware of this variables… sounds like leftover form other variant e.g. linuxserver.io use this variables.

I try the solution but didn’t worked.
when I run occ upgrade inside the container I get this error:
Console has to be executed with the user that owns the data directory
Current user id: 33
Owner id of the data directory: 1000
Try adding ‘sudo -u #1000’ to the beginning of the command (without the single quotes)
If running with ‘docker exec’ try adding the option ‘-u 1000’ to the docker command (without the single quotes)

so I change owenership to the whole folder but then I get

Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Turned on maintenance mode
Updating database schema
Doctrine\DBAL\Exception\DriverException: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1005 Can’t create table nextcloud.oc_migrations (errno: 13 “Permission denied”)
Update failed
Maintenance mode is kept active
Resetting log level

this is exactly what you have to do. your data directory is owned by uid 1000 so you should run docker exec --user 1000 {app container} php occ

why? if you change data folder permissions you must adjust the rest of your config e.g. UID of the container user.

yes i did it. i run with -u 1000
but when I run the occ upgrade I get
Doctrine\DBAL\Exception\DriverException: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1005 Can’t create table nextcloud .oc_migrations (errno: 13 “Permission denied”)

1 Like

after I fix directory permission I get the point. my data dir is nfs.
I still getting data dir is not wrtitable

my fstab looks like:
192.168.0.101:/mnt/seagate /mnt/seagate nfs defaults,user,noauto,relatime,rw 0 0

nc datadirectory is stored in /mnt/seagate/nextcloud/data

any ideas?

1 Like

finally I managed to fix it. my nfs export was wrong. added no_root_squash and remove anonid and it works perfectly. thx for the help

2 Likes