Docker - use user: xxxx:xxxx in compose does not work #1923

Closed
opened 2026-03-22 13:46:29 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @O491dogan on GitHub (Feb 28, 2024).

Description

Deploying the docker container with the provided examples works well.

But I would like to have vikunja run not as user "1000". Here the documentation (https://vikunja.io/docs/full-docker-example/) states, that one should use the --user-flag to accomplish this.

If I do so, vikunja won't start with the following messages:
info: creating the new user vikunja with 1000:1000
groupmod /etc/group.8: Permission denied
groupmod: cannot lock /etc/group; try again later.

On my docker host machine, I have some directories, that are owned by the user 1001 that are mapped to the container (please see the following compose - for testing purposes):

version: "3"
services:
  vikunja:
    image: vikunja/vikunja
    environment:
      VIKUNJA_SERVICE_PUBLICURL: http://192.168.178.59
      VIKUNJA_DATABASE_HOST: db
      VIKUNJA_DATABASE_PASSWORD: vikunjapw
      VIKUNJA_DATABASE_TYPE: mysql
      VIKUNJA_DATABASE_USER: vikunja
      VIKUNJA_DATABASE_DATABASE: vikunja
      VIKUNJA_SERVICE_JWTSECRET: vikunjapwsecret
    ports:
      - 3456:3456
    volumes:
      - /home/dockerApps/vikunja/files:/app/vikunja/files
    user: 1001:1001
    depends_on:
      db:
        condition: service_healthy
    restart: unless-stopped
  db:
    image: mariadb:10
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_ROOT_PASSWORD: vikunjadbroot
      MYSQL_USER: vikunja
      MYSQL_PASSWORD: vikunjapw
      MYSQL_DATABASE: vikunja
    volumes:
      - /home/dockerApps/vikunja/database:/var/lib/mysql
    user: 1001:1001
    restart: unless-stopped
    healthcheck:
      test: ["CMD-SHELL", "mysqladmin ping -h localhost -u $$MYSQL_USER --password=$$MYSQL_PASSWORD"]
      interval: 2s
      start_period: 30s

What I see happening on the host is, that the directory /home/dockerApps/vikunja/files/, previously owned by 1001:1001 is owned by 1000:1000 after the start of the container.

It seems like the user: 1001:1001 statement is ignored and vikunja tries to run as the default 1000.

Does anyone ever have this issue, too and can provide some help or solution?

Thank you very much!

Vikunja Version

sha256:25544141064373ce2f1c56aa88a77b5346651e2d0708f8c0cda6fc54c1893f53

Browser and version

not relevant

Can you reproduce the bug on the Vikunja demo site?

No

Screenshots

Not necessary.

Originally created by @O491dogan on GitHub (Feb 28, 2024). ### Description Deploying the docker container with the provided examples works well. But I would like to have vikunja run not as user "1000". Here the documentation (https://vikunja.io/docs/full-docker-example/) states, that one should use the **--user**-flag to accomplish this. If I do so, vikunja won't start with the following messages: `info: creating the new user vikunja with 1000:1000` `groupmod /etc/group.8: Permission denied` `groupmod: cannot lock /etc/group; try again later.` On my docker host machine, I have some directories, that are owned by the user 1001 that are mapped to the container (please see the following compose - for testing purposes): ``` version: "3" services: vikunja: image: vikunja/vikunja environment: VIKUNJA_SERVICE_PUBLICURL: http://192.168.178.59 VIKUNJA_DATABASE_HOST: db VIKUNJA_DATABASE_PASSWORD: vikunjapw VIKUNJA_DATABASE_TYPE: mysql VIKUNJA_DATABASE_USER: vikunja VIKUNJA_DATABASE_DATABASE: vikunja VIKUNJA_SERVICE_JWTSECRET: vikunjapwsecret ports: - 3456:3456 volumes: - /home/dockerApps/vikunja/files:/app/vikunja/files user: 1001:1001 depends_on: db: condition: service_healthy restart: unless-stopped db: image: mariadb:10 command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci environment: MYSQL_ROOT_PASSWORD: vikunjadbroot MYSQL_USER: vikunja MYSQL_PASSWORD: vikunjapw MYSQL_DATABASE: vikunja volumes: - /home/dockerApps/vikunja/database:/var/lib/mysql user: 1001:1001 restart: unless-stopped healthcheck: test: ["CMD-SHELL", "mysqladmin ping -h localhost -u $$MYSQL_USER --password=$$MYSQL_PASSWORD"] interval: 2s start_period: 30s ``` What I see happening on the host is, that the directory **/home/dockerApps/vikunja/files/**, previously owned by 1001:1001 is owned by 1000:1000 after the start of the container. It seems like the **user: 1001:1001** statement is ignored and vikunja tries to run as the default 1000. Does anyone ever have this issue, too and can provide some help or solution? Thank you very much! ### Vikunja Version sha256:25544141064373ce2f1c56aa88a77b5346651e2d0708f8c0cda6fc54c1893f53 ### Browser and version not relevant ### Can you reproduce the bug on the Vikunja demo site? No ### Screenshots Not necessary.
Author
Owner

@kolaente commented on GitHub (Feb 28, 2024):

This has been changed lately but not yet released as a stable version. Does it work with an unstable build? (add the :unstable tag to the docker image).

@kolaente commented on GitHub (Feb 28, 2024): This has been changed lately but not yet released as a stable version. Does it work with an unstable build? (add the `:unstable` tag to the docker image).
Author
Owner

@O491dogan commented on GitHub (Feb 28, 2024):

Hi there!
Thank you for taking the time for a response.

I have tried the current :unstable build and what should I say: It works as expected!

Thank you again - I'm looking forward to the next stable version :-)

@O491dogan commented on GitHub (Feb 28, 2024): Hi there! Thank you for taking the time for a response. I have tried the current `:unstable` build and what should I say: **It works as expected!** Thank you again - I'm looking forward to the next stable version :-)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#1923