[GH-ISSUE #215] Adding Drivers to Custom Dockerfile #58

Closed
opened 2026-03-07 20:44:18 +03:00 by kerem · 10 comments
Owner

Originally created by @jefflester on GitHub (Nov 12, 2020).
Original GitHub issue: https://github.com/dbeaver/cloudbeaver/issues/215

I am trying to add a driver to the CloudBeaver Docker container and am running into some issues. I believe this is similar to issue #208. Reading the Wiki, this was how I expected things would work from a Dockerfile perspective:

Dockerfile:

FROM dbeaver/cloudbeaver:1.2.0

ADD ./pom.xml server/drivers/prestosql/
ADD ./plugin.xml server/bundles/io.cloudbeaver.resources.drivers.base/

Driver pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>drivers.prestosql</artifactId>
    <version>1.0.0</version>
    <parent>
        <groupId>io.cloudbeaver</groupId>
        <artifactId>drivers</artifactId>
        <version>1.0.0</version>
        <relativePath>../</relativePath>
    </parent>
    <properties>
        <deps.output.dir>prestosql</deps.output.dir>
    </properties>
    <dependencies>
        <dependency>
            <groupId>io.prestosql</groupId>
            <artifactId>presto-jdbc</artifactId>
            <version>338</version>
        </dependency>
    </dependencies>
</project>

Plugin XML:

<!-- Bundles  -->
<extension point="org.jkiss.dbeaver.product.bundles">
    <bundle id="drivers.clickhouse" label="Clickhouse drivers"/>
    <bundle id="drivers.derby" label="Derby drivers"/>
    <bundle id="drivers.firebird" label="Firebird drivers"/>
    <bundle id="drivers.h2" label="H2 drivers"/>
    <bundle id="drivers.mysql" label="MySQL drivers"/>
    <bundle id="drivers.mariadb" label="MariaDB drivers"/>
    <bundle id="drivers.postgresql" label="PostgreSQL drivers"/>
    <bundle id="drivers.prestosql" label="PrestoSQL drivers"/>
    <bundle id="drivers.sqlite.xerial" label="SQLite drivers"/>
</extension>

<!-- Enabled drivers -->
<extension point="io.cloudbeaver.driver">
    <driver id="generic:yandex_clickhouse"/>
    <driver id="generic:derby_server"/>
    <driver id="jaybird:jaybird"/>
    <driver id="generic:h2_embedded"/>
    <driver id="mysql:mysql8"/>
    <driver id="mysql:mariaDB"/>
    <driver id="postgresql:postgres-jdbc"/>
    <driver id="generic:prestosql_jdbc"/>
    <driver id="generic:sqlite_jdbc"/>
</extension>
```

However, it appears these instructions expect the user to be building from source with the build.sh script after the relevant files have been updated/added. Going off that, it looks like the cloudbeaver source is added to the Docker image after the build.sh script is run, per the Dockerfile.

Is there an interim Maven command I need to add to the image entrypoint to get this to work? The default entrypoint ENTRYPOINT ["./run-server.sh"] does not register the added drivers since no build commands are executed.

Thanks for any and all clarification, and I am very excited to start using this! I'm happy to create a doc PR to update the instructions for adding drivers to a custom Dockerfile if that would be helpful as well.

Originally created by @jefflester on GitHub (Nov 12, 2020). Original GitHub issue: https://github.com/dbeaver/cloudbeaver/issues/215 I am trying to add a driver to the CloudBeaver Docker container and am running into some issues. I believe this is similar to issue #208. Reading the [Wiki](https://github.com/dbeaver/cloudbeaver/wiki/Driver-managements), this was how I expected things would work from a Dockerfile perspective: Dockerfile: ``` FROM dbeaver/cloudbeaver:1.2.0 ADD ./pom.xml server/drivers/prestosql/ ADD ./plugin.xml server/bundles/io.cloudbeaver.resources.drivers.base/ ``` Driver `pom.xml`: ``` <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>drivers.prestosql</artifactId> <version>1.0.0</version> <parent> <groupId>io.cloudbeaver</groupId> <artifactId>drivers</artifactId> <version>1.0.0</version> <relativePath>../</relativePath> </parent> <properties> <deps.output.dir>prestosql</deps.output.dir> </properties> <dependencies> <dependency> <groupId>io.prestosql</groupId> <artifactId>presto-jdbc</artifactId> <version>338</version> </dependency> </dependencies> </project> ``` Plugin XML: <?xml version="1.0" encoding="UTF-8"?> <plugin> <!-- Resource mappings --> <extension point="org.jkiss.dbeaver.resources"> <resource name="drivers/clickhouse"/> <resource name="drivers/derby"/> <resource name="drivers/jaybird"/> <resource name="drivers/h2"/> <resource name="drivers/mysql/mysql8"/> <resource name="drivers/mariadb"/> <resource name="drivers/postgresql"/> <resource name="drivers/prestosql"/> <resource name="drivers/sqlite/xerial"/> </extension> <!-- Bundles --> <extension point="org.jkiss.dbeaver.product.bundles"> <bundle id="drivers.clickhouse" label="Clickhouse drivers"/> <bundle id="drivers.derby" label="Derby drivers"/> <bundle id="drivers.firebird" label="Firebird drivers"/> <bundle id="drivers.h2" label="H2 drivers"/> <bundle id="drivers.mysql" label="MySQL drivers"/> <bundle id="drivers.mariadb" label="MariaDB drivers"/> <bundle id="drivers.postgresql" label="PostgreSQL drivers"/> <bundle id="drivers.prestosql" label="PrestoSQL drivers"/> <bundle id="drivers.sqlite.xerial" label="SQLite drivers"/> </extension> <!-- Enabled drivers --> <extension point="io.cloudbeaver.driver"> <driver id="generic:yandex_clickhouse"/> <driver id="generic:derby_server"/> <driver id="jaybird:jaybird"/> <driver id="generic:h2_embedded"/> <driver id="mysql:mysql8"/> <driver id="mysql:mariaDB"/> <driver id="postgresql:postgres-jdbc"/> <driver id="generic:prestosql_jdbc"/> <driver id="generic:sqlite_jdbc"/> </extension> </plugin> ``` However, it appears these instructions expect the user to be building from source with the `build.sh` script _after_ the relevant files have been updated/added. Going off that, it looks like the `cloudbeaver` source is added to the Docker image after the `build.sh` script is run, per the [Dockerfile](https://github.com/dbeaver/cloudbeaver/blob/devel/deploy/docker/Dockerfile#L6). Is there an interim Maven command I need to add to the image entrypoint to get this to work? The default entrypoint `ENTRYPOINT ["./run-server.sh"]` does not register the added drivers since no build commands are executed. Thanks for any and all clarification, and I am very excited to start using this! I'm happy to create a doc PR to update the instructions for adding drivers to a custom Dockerfile if that would be helpful as well.
kerem 2026-03-07 20:44:18 +03:00
Author
Owner

@jefflester commented on GitHub (Nov 18, 2020):

I confirmed that the COPY cloudbeaver /opt/cloudbeaver Dockerfile instruction is grabbing the build artifacts resulting from build.sh script. So it does in fact appear that the only way to add drivers to your Dockerized CloudBeaver is to design your own Dockerfile and to copy over your own built distribution.

If I'm wrong and there's an easier way to do this, please let me know.

<!-- gh-comment-id:729961583 --> @jefflester commented on GitHub (Nov 18, 2020): I confirmed that the `COPY cloudbeaver /opt/cloudbeaver` Dockerfile instruction is grabbing the build artifacts resulting from `build.sh` script. So it does in fact appear that the only way to add drivers to your Dockerized CloudBeaver is to design your own Dockerfile and to copy over your own built distribution. If I'm wrong and there's an easier way to do this, please let me know.
Author
Owner

@serge-rider commented on GitHub (Nov 19, 2020):

You don't need to change Dockerfile in order to add drivers. Dockerfile copies all drivers configured in pom.xml and pluginx.xml.
We plan to add Presto as pre-configured driver in the next version (1.3).

<!-- gh-comment-id:730226001 --> @serge-rider commented on GitHub (Nov 19, 2020): You don't need to change Dockerfile in order to add drivers. Dockerfile copies all drivers configured in pom.xml and pluginx.xml. We plan to add Presto as pre-configured driver in the next version (1.3).
Author
Owner

@jefflester commented on GitHub (Nov 19, 2020):

Thanks for confirming, @serge-rider. A couple of quick followup questions:

  1. Do you plan to add PrestoSQL, PrestoDB, or both drivers in the 1.3 release?
  2. If you don't need to change/make your own Dockerfile, how do you actually add drivers to a container? I'm probably misunderstanding (if this is possible), but it looks like you need to clone the CloudBeaver source, add the new driver resources, build it, and then add the built distro to your own Dockerfile.

Thank you again! We're really excited to start using this. :)

<!-- gh-comment-id:730478753 --> @jefflester commented on GitHub (Nov 19, 2020): Thanks for confirming, @serge-rider. A couple of quick followup questions: 1. Do you plan to add PrestoSQL, PrestoDB, or both drivers in the 1.3 release? 2. If you don't need to change/make your own Dockerfile, how do you actually add drivers to a container? I'm probably misunderstanding (if this is possible), but it looks like you need to clone the CloudBeaver source, add the new driver resources, build it, and then add the built distro to your own Dockerfile. Thank you again! We're really excited to start using this. :)
Author
Owner

@darint00 commented on GitHub (Nov 20, 2020):

Yes, please explain how to add a driver to the container. I have an Informix driver I'd like to add. And the only thing, as mentioned above, I can think of is ..

  1. Create your own image with a dockerfile that adds the specific driver you want.
    If there is another way, easier way, please let us know.
<!-- gh-comment-id:731381951 --> @darint00 commented on GitHub (Nov 20, 2020): Yes, please explain how to add a driver to the container. I have an Informix driver I'd like to add. And the only thing, as mentioned above, I can think of is .. 1. Create your own image with a dockerfile that adds the specific driver you want. If there is another way, easier way, please let us know.
Author
Owner

@mskyttner commented on GitHub (Dec 16, 2020):

I too would like to add a driver but didn't figure it out.

This is a draft multi-stage Dockerfile that builds in the first step and then moves build results in the second step (probably some things are moved which doesn't need to be moved, I'm a bit unfamiliar with the build tools).

But where would I add my jdbc driver?

FROM adoptopenjdk/openjdk11:x86_64-ubuntu-jdk-11.0.7_10

RUN apt-get update -y && apt-get install -y \
	nano \
	git \
	maven

RUN apt-get install -y gnupg && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - 

RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && \
	apt-get update -y && apt-get install -y --no-install-recommends \
	yarn

# build server
RUN mkdir conf workspace web
RUN git clone --depth=1 https://github.com/dbeaver/cloudbeaver.git
RUN git clone --depth=1 https://github.com/dbeaver/dbeaver.git

WORKDIR /cloudbeaver

RUN cd server/product/aggregate && \
	mvn clean package -Dheadless-platform

RUN cp -rp server/product/web-server/target/products/io.cloudbeaver.product/all/all/all/* server && \
	cp -p deploy/scripts/* .

RUN mkdir -p deploy/cloudbeaver/samples/db deploy/cloudbeaver/conf && \
	cp -rp samples/sample-databases/db deploy/cloudbeaver/samples/ && \
	cp -rp samples/sample-databases/GlobalConfiguration/.dbeaver/data-sources.json deploy/cloudbeaver/conf/initial-data-sources.conf && \
	cp -p samples/sample-databases/*.conf deploy/cloudbeaver/conf/ && \
	mv server/drivers deploy/cloudbeaver

# build frontend

RUN curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh && \
	chmod +x ./nodesource_setup.sh && ./nodesource_setup.sh && \
	apt-get install -y nodejs

RUN cd webapp && yarn && \
	yarn add -W lerna --dev && \
	npm install --global lerna && \
	lerna run build --stream --scope=@cloudbeaver/product-default -- -- --mode=production

RUN mkdir -p deploy/cloudbeaver/web && \
	cp -rp webapp/packages/product-default/lib/* deploy/cloudbeaver/web

RUN mv /cloudbeaver /opt/cloudbeaver

FROM adoptopenjdk/openjdk11:alpine-slim

COPY --from=0 /opt/cloudbeaver /opt/cloudbeaver

RUN apk --update --no-cache add tini bash

WORKDIR /opt/cloudbeaver

EXPOSE 8978
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/opt/cloudbeaver/run-server.sh"]
<!-- gh-comment-id:746694576 --> @mskyttner commented on GitHub (Dec 16, 2020): I too would like to add a driver but didn't figure it out. This is a draft multi-stage Dockerfile that builds in the first step and then moves build results in the second step (probably some things are moved which doesn't need to be moved, I'm a bit unfamiliar with the build tools). But where would I add my jdbc driver? ```Dockerfile FROM adoptopenjdk/openjdk11:x86_64-ubuntu-jdk-11.0.7_10 RUN apt-get update -y && apt-get install -y \ nano \ git \ maven RUN apt-get install -y gnupg && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && \ apt-get update -y && apt-get install -y --no-install-recommends \ yarn # build server RUN mkdir conf workspace web RUN git clone --depth=1 https://github.com/dbeaver/cloudbeaver.git RUN git clone --depth=1 https://github.com/dbeaver/dbeaver.git WORKDIR /cloudbeaver RUN cd server/product/aggregate && \ mvn clean package -Dheadless-platform RUN cp -rp server/product/web-server/target/products/io.cloudbeaver.product/all/all/all/* server && \ cp -p deploy/scripts/* . RUN mkdir -p deploy/cloudbeaver/samples/db deploy/cloudbeaver/conf && \ cp -rp samples/sample-databases/db deploy/cloudbeaver/samples/ && \ cp -rp samples/sample-databases/GlobalConfiguration/.dbeaver/data-sources.json deploy/cloudbeaver/conf/initial-data-sources.conf && \ cp -p samples/sample-databases/*.conf deploy/cloudbeaver/conf/ && \ mv server/drivers deploy/cloudbeaver # build frontend RUN curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh && \ chmod +x ./nodesource_setup.sh && ./nodesource_setup.sh && \ apt-get install -y nodejs RUN cd webapp && yarn && \ yarn add -W lerna --dev && \ npm install --global lerna && \ lerna run build --stream --scope=@cloudbeaver/product-default -- -- --mode=production RUN mkdir -p deploy/cloudbeaver/web && \ cp -rp webapp/packages/product-default/lib/* deploy/cloudbeaver/web RUN mv /cloudbeaver /opt/cloudbeaver FROM adoptopenjdk/openjdk11:alpine-slim COPY --from=0 /opt/cloudbeaver /opt/cloudbeaver RUN apk --update --no-cache add tini bash WORKDIR /opt/cloudbeaver EXPOSE 8978 ENTRYPOINT ["/sbin/tini", "--"] CMD ["/opt/cloudbeaver/run-server.sh"] ```
Author
Owner

@momiji commented on GitHub (Jan 8, 2021):

does it help #259 ?

<!-- gh-comment-id:757041678 --> @momiji commented on GitHub (Jan 8, 2021): does it help #259 ?
Author
Owner

@jefflester commented on GitHub (Jan 12, 2021):

does it help #259 ?

@momiji It adds some clarity––it looks like your flow involves cloning both DBeaver and Cloudbeaver, making adjustments to each repository, and then building them with the changes. Please correct me if I'm wrong.

I'm interested in using the provided Docker image and extending it through my own Dockerfile without the need to modify and build both the DBeaver and CloudBeaver repositories. If that's the required flow, I'll probably wait until release 1.3 comes out for native support of Presto JDBC drivers. Speaking of which, @serge-rider do you know if you're adding the Trino (formerly PrestoSQL) or the PrestoDB drivers?

In terms of adding new drivers to the Docker image, this is how I'd envision it working:

FROM dbeaver/cloudbeaver:1.2.0

ADD ./pom.xml server/drivers/prestosql/
ADD ./plugin.xml server/bundles/io.cloudbeaver.resources.drivers.base/

Or by simply mounting the files to the base CloudBeaver image without modifying it through a Dockefile at all.

Thanks again, everyone!

<!-- gh-comment-id:758768167 --> @jefflester commented on GitHub (Jan 12, 2021): > does it help #259 ? @momiji It adds some clarity––it looks like your flow involves cloning both DBeaver and Cloudbeaver, making adjustments to each repository, and then building them with the changes. Please correct me if I'm wrong. I'm interested in using the provided Docker image and extending it through my own Dockerfile without the need to modify and build both the DBeaver and CloudBeaver repositories. If that's the required flow, I'll probably wait until release 1.3 comes out for native support of Presto JDBC drivers. Speaking of which, @serge-rider do you know if you're adding the [Trino](https://github.com/trinodb/trino) (formerly PrestoSQL) or the PrestoDB drivers? In terms of adding new drivers to the Docker image, this is how I'd envision it working: ``` FROM dbeaver/cloudbeaver:1.2.0 ADD ./pom.xml server/drivers/prestosql/ ADD ./plugin.xml server/bundles/io.cloudbeaver.resources.drivers.base/ ``` Or by simply mounting the files to the base CloudBeaver image without modifying it through a Dockefile at all. Thanks again, everyone!
Author
Owner

@momiji commented on GitHub (Jan 12, 2021):

Hi,

@momiji It adds some clarity––it looks like your flow involves cloning both DBeaver and Cloudbeaver, making adjustments to each repository, and then building them with the changes. Please correct me if I'm wrong.

Absolutely, you're right.

Concerning your idea ti build from docker image, what you're proposing cannot work, because adding the pom.xml is not for the single purpose of adding a new file on the filesystem, but to add a new sub-project in the project building process (which uses maven, which uses pom.xml...).

So my understanding is you definitely need to rebuild the project... Then, rebuilding one or two, no difference especially as the build.sh script rebuilds both...

Regards.

<!-- gh-comment-id:758867579 --> @momiji commented on GitHub (Jan 12, 2021): Hi, > @momiji It adds some clarity––it looks like your flow involves cloning both DBeaver and Cloudbeaver, making adjustments to each repository, and then building them with the changes. Please correct me if I'm wrong. Absolutely, you're right. Concerning your idea ti build from docker image, what you're proposing cannot work, because adding the pom.xml is not for the single purpose of adding a new file on the filesystem, but to add a new sub-project in the project building process (which uses maven, which uses pom.xml...). So my understanding is you definitely need to rebuild the project... Then, rebuilding one or two, no difference especially as the build.sh script rebuilds both... Regards.
Author
Owner

@serge-rider commented on GitHub (Feb 1, 2021):

Please see instruction how to add new drivers: https://github.com/dbeaver/cloudbeaver/wiki/Adding-new-database-drivers

<!-- gh-comment-id:770885768 --> @serge-rider commented on GitHub (Feb 1, 2021): Please see instruction how to add new drivers: https://github.com/dbeaver/cloudbeaver/wiki/Adding-new-database-drivers
Author
Owner

@kseniiaguzeeva commented on GitHub (Feb 11, 2021):

Please ask to reopen the ticket if you have some additional questions.

<!-- gh-comment-id:777305577 --> @kseniiaguzeeva commented on GitHub (Feb 11, 2021): Please ask to reopen the ticket if you have some additional questions.
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#58
No description provided.