Can only login the first time on a docker container

im deploying a grafana server in docker with compose with the following compose file:

services:
  grafana:
    image: grafana/grafana
    network_mode: bridge
    container_name: grafana_V2
    restart: unless-stopped
    environment:
#     - GF_INSTALL_PLUGINS=grafana-clock-panel
#     - GF_AUTH_ANONYMOUS_ENABLED=true
     - GF_SECURITY_COOKIE_SAMESITE=none #added
     - GF_SECURITY_ALLOW_EMBEDDING=true #added
     - GF_SECURITY_COOKIE_SECURE=false
     - GF_SERVER_ROOT_URL=http://192.168.0.246/
     - GF_LOG_LEVEL=debug

    ports:
     - '3000:3000'
    volumes:
     - '/var/lib/grafana:/var/lib/grafana'

i have an old database from my older grafana server, i think it was version 8. I added this to the location, and then starter grafana. Now i can login once iwth the old user i have, but everytime after that i cant login,. i just get a short refresh of the page where it says “succes” on login in and then the page refresh the login site.

The log only says:

logger=authn.service t=2024-12-20T21:37:55.2852909Z level=warn msg=“Failed to authenticate request” client=auth.client.session error=“user token not found”

now if i remove the old database, and let grafana create a new one, i then login with admin / admin, it then ask me to change password, when i do that it says in “unauthorised” if i press continue im at the login screen again, and i can login with admin / admin again, and then it asks me to change the password.

also i tried to download the grafana server for windows, and use my old database, but that works just fine, where i can login and out all the times i want. The file permissions on the database is:

ls -la /var/lib/grafana/
total 2756
drwxr-xr-x  7  472  472    4096 Dec 20 22:24 .
drwxr-xr-x 44 root root    4096 Aug  4 15:36 ..
drwx------  2  472 root    4096 Dec 20 19:27 csv
drwxr-xr-x  2  472 root    4096 Dec 20 22:03 etc
-rw-rw-rw-  1  472 root 2793472 Dec 20 22:07 grafana.db
drwx------  2  472 root    4096 Dec 20 19:27 pdf
drwxr-xr-x  4  472 root    4096 Dec 20 19:27 plugins
drwx------  2  472 root    4096 Dec 20 19:27 png
user@ubuntu:~$

So what am i missing?

this var seem to be the one making the problem
GF_SECURITY_COOKIE_SAMESITE=none

What happens if you comment it out