Skip to content
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

Getting a "attempt to write a readonly database" error for SQLite db #167

Open
epicwhale opened this issue Feb 25, 2024 · 1 comment
Open

Comments

@epicwhale
Copy link

I am unable to figure out how why I am not able to edit the contents of the sqlite db from a directory I have mounted in my compose below. I tried the :rw suffix for the volume too, but I keep getting a "attempt to write a readonly database"

image

  adminer:
    image: adminer
    environment:
      - ADMINER_PASSWORD=${ADMINER_PASSWORD}
    volumes:
      - ./data:/data:rw
      - ./adminer-plugins/login-password-less.php:/var/www/html/plugins-enabled/login-password-less.php
    ports:
      - 8080:8080

My db is app.db in the data/ directory. I am having no trouble viewing the database in adminer, just all edit operations fail with the above error.

Can someone help me with me any pointers to resolve this? thanks in advance!

@epicwhale epicwhale changed the title "attempt to write a readonly database" "attempt to write a readonly database" for SQLite db Feb 25, 2024
@epicwhale epicwhale changed the title "attempt to write a readonly database" for SQLite db Getting a "attempt to write a readonly database" error for SQLite db Feb 25, 2024
@epicwhale
Copy link
Author

It looks like the docker container switches to a user 'adminer', where as anything I mount from the host container fails to be writeable by the 'adminer' user insider the container.

A temporary workaround I figured is updating the compose user to root like below:

  adminer:
    image: adminer
    environment:
      - ADMINER_PLUGINS=fc-sqlite-connection-without-credentials
    user: root  # without this, I can't write to sqlite file (as the container runs as an adminer user)
    volumes:
      - ./data:/data
      - ./adminer-plugins/fc-sqlite-connection-without-credentials.php:/var/www/html/plugins/fc-sqlite-connection-without-credentials.php
    ports:
      - 8080:8080

Anyone with a more elegant solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant