Search code examples
javapostgresqldockerlibreoffice

Adding Archive to Libre Office using Docker


In one folder I have two files: Dockerfile and postgresql-42.2.4.jar

Dockerfile:

from ubuntu:16.04
RUN apt-get update && apt-get install -y \
    libreoffice-base

COPY postgresql-42.2.4.jar postgresql-42.2.4.jar

CMD ["usr/bin/libreoffice"]

postgresql-42.2.4.jar:

I downloaded PostgreSQL JDBC archive from PostgreSQL official site

To run docker I used:

docker build -t gui-app .

then:

docker run --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" gui-app

Libre Office run correctly, but when I want to add Class Path (link to Libre help site) I can't find .jar file which I copied in Dockerfile.

I didn't manually install JRE, but I think JRE is build in ubuntu.

Why I can't find JDBC archive file? scrrenshot


Solution

  • There is no JRE installed by default in the docker image ubuntu:16.04. You can inspect the list of installed packages by running:

    docker run -it ubuntu:16.04 apt list
    

    You can install the default JRE in your Dockerfile by adding the default-jre package:

    FROM ubuntu:16.04
    RUN apt-get update && apt-get install -y \
        libreoffice-base default-jre
    
    COPY postgresql-42.2.4.jar postgresql-42.2.4.jar
    
    CMD ["usr/bin/libreoffice"]