[GH-ISSUE #1141] Docker image creates files as root in mounted directory #242

Closed
opened 2026-03-07 20:46:45 +03:00 by kerem · 3 comments
Owner

Originally created by @mjarosie on GitHub (Sep 10, 2022).
Original GitHub issue: https://github.com/dbeaver/cloudbeaver/issues/1141

Describe the bug

Docker image creates files as root in mounted directory. That prevents me from modifying the content of the default configuration after it's created by the container (as my IDE is running as non-root).

To Reproduce

# Start in an empty directory
mkdir workspace

cat > docker-compose.yaml<< EOF
services:
  cloudbeaver:
    image: dbeaver/cloudbeaver:22.2.0
    # user: "1001:1001"
    environment:
      - CB_SERVER_NAME="CloudBeaver local server"
      - CB_SERVER_URL=http://localhost:8081
      - CB_ADMIN_NAME=cbadmin
      - CB_ADMIN_PASSWORD=password
    ports:
      - 8081:8978
    volumes:
      - ./workspace:/opt/cloudbeaver/workspace
EOF

docker compose up
# Give it a few seconds to spin up...
# Ctrl+C when you see a log saying "[main] INFO  org.eclipse.jetty.server.Server - Started JettyServer"

The output of ls -al workspace now is:

total 24
drwxr-xr-x 6 user user 4096 Sep 10 23:11 .
drwxr-xr-x 3 user user 4096 Sep 10 23:10 ..
drwxr-xr-x 2 root     root     4096 Sep 10 23:11 .data
drwxr-xr-x 4 root     root     4096 Sep 10 23:11 .metadata
drwxr-xr-x 4 root     root     4096 Sep 10 23:11 .work-data
drwxr-xr-x 3 root     root     4096 Sep 10 23:11 GlobalConfiguration

Desktop (please complete the following information):

  • OS: Windows running on WSL2 (Ubuntu 20.04)
  • Version: 22.2.0

Additional context

When I try running the container as a non-root user (i.e. uncomment # user line in docker-compose.yaml file) - the application fails to start with the following error:

cloudbeaver-1  | Starting Cloudbeaver Server
cloudbeaver-1  | <title>Invalid Configuration Location</title>The configuration area at '/opt/cloudbeaver/?/.eclipse/248865309_linux_gtk_x86_64/configuration' could not be created.  Please choose a writable location using the '-configuration' command line option.
cloudbeaver-1 exited with code 15

An obvious workaround is to chown files that I'd like to modify in my IDE. I'm wondering if there's any easier way to make it work (e.g. make the container run as a non-root user).

Originally created by @mjarosie on GitHub (Sep 10, 2022). Original GitHub issue: https://github.com/dbeaver/cloudbeaver/issues/1141 **Describe the bug** Docker image creates files as root in mounted directory. That prevents me from modifying the content of the default configuration after it's created by the container (as my IDE is running as non-root). **To Reproduce** ```bash # Start in an empty directory mkdir workspace cat > docker-compose.yaml<< EOF services: cloudbeaver: image: dbeaver/cloudbeaver:22.2.0 # user: "1001:1001" environment: - CB_SERVER_NAME="CloudBeaver local server" - CB_SERVER_URL=http://localhost:8081 - CB_ADMIN_NAME=cbadmin - CB_ADMIN_PASSWORD=password ports: - 8081:8978 volumes: - ./workspace:/opt/cloudbeaver/workspace EOF docker compose up # Give it a few seconds to spin up... # Ctrl+C when you see a log saying "[main] INFO org.eclipse.jetty.server.Server - Started JettyServer" ``` The output of `ls -al workspace` now is: ``` total 24 drwxr-xr-x 6 user user 4096 Sep 10 23:11 . drwxr-xr-x 3 user user 4096 Sep 10 23:10 .. drwxr-xr-x 2 root root 4096 Sep 10 23:11 .data drwxr-xr-x 4 root root 4096 Sep 10 23:11 .metadata drwxr-xr-x 4 root root 4096 Sep 10 23:11 .work-data drwxr-xr-x 3 root root 4096 Sep 10 23:11 GlobalConfiguration ``` **Desktop (please complete the following information):** - OS: Windows running on WSL2 (Ubuntu 20.04) - Version: 22.2.0 **Additional context** When I try running the container as a non-root user (i.e. uncomment `# user` line in `docker-compose.yaml` file) - the application fails to start with the following error: ``` cloudbeaver-1 | Starting Cloudbeaver Server cloudbeaver-1 | <title>Invalid Configuration Location</title>The configuration area at '/opt/cloudbeaver/?/.eclipse/248865309_linux_gtk_x86_64/configuration' could not be created. Please choose a writable location using the '-configuration' command line option. cloudbeaver-1 exited with code 15 ``` An obvious workaround is to `chown` files that I'd like to modify in my IDE. I'm wondering if there's any easier way to make it work (e.g. make the container run as a non-root user).
kerem 2026-03-07 20:46:45 +03:00
Author
Owner

@kseniaguzeeva commented on GitHub (Sep 14, 2022):

Thank you for the report. We are going to fix this issue. To do this, we need to investigate it in order to find the best solution of this problem.

<!-- gh-comment-id:1246745882 --> @kseniaguzeeva commented on GitHub (Sep 14, 2022): Thank you for the report. We are going to fix this issue. To do this, we need to investigate it in order to find the best solution of this problem.
Author
Owner

@mayerro commented on GitHub (Dec 16, 2022):

@mjarosie
before container starts you must build your own image with an user inside.
Create Dockerfile which contains:

FROM dbeaver/cloudbeaver:22.2.0
RUN groupadd cloudbeaver
RUN useradd -ms /bin/bash -g cloudbeaver cloudbeaver
RUN chown -R cloudbeaver ./
USER cloudbeaver

In next step change your compose file:

  • remove
    image: dbeaver/cloudbeaver:22.2.0
  • add
   
    build:
      context: .
    

Search additional information about build here

Now you can run compose

<!-- gh-comment-id:1354615210 --> @mayerro commented on GitHub (Dec 16, 2022): @mjarosie before container starts you must build your own image with an user inside. Create **Dockerfile** which contains: ``` FROM dbeaver/cloudbeaver:22.2.0 RUN groupadd cloudbeaver RUN useradd -ms /bin/bash -g cloudbeaver cloudbeaver RUN chown -R cloudbeaver ./ USER cloudbeaver ``` In next step change your compose file: - remove ``` image: dbeaver/cloudbeaver:22.2.0 ``` - add ``` build: context: . ``` Search additional information about **build** [here](https://docs.docker.com/compose/compose-file/build/) Now you can run compose
Author
Owner

@kseniaguzeeva commented on GitHub (Jan 9, 2023):

I close the ticket, because I don't see any updates for a long time. If you have any questions, feel free to contact me to reopen the ticket.

<!-- gh-comment-id:1375261702 --> @kseniaguzeeva commented on GitHub (Jan 9, 2023): I close the ticket, because I don't see any updates for a long time. If you have any questions, feel free to contact me to reopen the ticket.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cloudbeaver#242
No description provided.