cloudbeaver
cloudbeaver copied to clipboard
Docker image creates files as root in mounted directory
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).
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.
@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
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.