jlesage / docker-baseimage-gui

A minimal docker baseimage to ease creation of X graphical application containers
MIT License
1.2k stars 179 forks source link

Application stopped working after update #77

Closed Loader23 closed 2 years ago

Loader23 commented 2 years ago

Hi,

after upgrading from alpine:3.12-glibc my Application does not start anymore. Nothing in log except:

[supervisor  ] starting service 'app'...
[supervisor  ] service 'app' exited (got signal SIGSEGV).

Dockerfile:

FROM jlesage/baseimage-gui:alpine-3.16-v4

ENV VERSION 0.59.2
ENV ARCHIVE https://github.com/buchen/portfolio/releases/download/${VERSION}/PortfolioPerformance-${VERSION}-linux.gtk.x86_64.tar.gz
ENV APP_ICON_URL=https://www.portfolio-performance.info/images/logo.png

RUN apk --no-cache add ca-certificates wget && update-ca-certificates && \
    cd /opt && wget ${ARCHIVE} && tar xvzf PortfolioPerformance-${VERSION}-linux.gtk.x86_64.tar.gz && \
    rm PortfolioPerformance-${VERSION}-linux.gtk.x86_64.tar.gz

RUN install-glibc

RUN \
    add-pkg \
        openjdk17-jre \
        webkit2gtk \
        gtk+3.0 \
        xterm

RUN \
    sed -i '1s;^;-configuration\n/opt/portfolio/configuration\n-data\n/opt/portfolio/workspace\n;' /opt/portfolio/PortfolioPerformance.ini && \
    echo "osgi.nl=de" >> /opt/portfolio/configuration/config.ini && \
    chmod -R 777 /opt/portfolio && \
    install_app_icon.sh "$APP_ICON_URL"

# Copy the start script.
COPY startapp.sh /startapp.sh

# Set the name of the application.
ENV APP_NAME="Portfolio Performance"

startapp.sh:

#!/bin/sh
exec /opt/portfolio/PortfolioPerformance

It is also not working with alpine 3.13 and openjdk11. With alpine:3.12-glibc I could start it with xterm to look for errors but now the xterm windows is just restarting. Any Ideas?

jlesage commented 2 years ago

When you say that it's not working with alpine 3.13, this is with baseimage v3 or v4 ?

Loader23 commented 2 years ago

Both are not working.

jlesage commented 2 years ago

If the v3 is not working, then I suspect the problem (crash) is caused by usage of non-glibc libraries by your glibc program.

Compatibility between musl (glibc alternative used by alpine) and glibc is very limited. By experience, it's also very fragile. You may have a glibc program that uses musl libraries without issue. But as soon as the program or a library is updated, program may start to crash.

I see that your application is a Java one. Probably that the PortfolioPerformance binary is just a launcher, so maybe you could start the app by invoking the correct "main" jar file (java -jar /path/to/jar) ?

Also, Java applications sometime manually load or use .so libraries that are part of their packages. This could also be an issue.

If you want to try to start the app manually, your can login to the container's shell using docker exec -ti <container name> sh. To make sure the container stays up and running, create the container with -e KEEP_APP_RUNNING=1.

Loader23 commented 2 years ago

The application is using eclipse. I can't find a main jar file to start. Like you said, I guess it has something to do with a updated library. The recent version of the application is running fine with alpine 3.12 and does not start with 3.13. To start the app manually I have always used xterm. Maybe you can build an alpine 3.12 v4 baseimage? :-)

jlesage commented 2 years ago

Unfortunately version 3.12 reached end of life and is no longer supported by Alpine Linux. So I don't think it make sense to support a baseimage for an unsupported distro.

By using strace you should be able to find which jar file is loaded first and which libraries are used, but this requires some work.

Another quick solution is to use a ubuntu or Debian baseimage, instead of Alpine.

Loader23 commented 2 years ago

Guess I'll try it with Debian then :-) I found this to keep the Image small: https://phoenixnap.com/kb/docker-image-size Can you recommend anything else for Debian Images?

Loader23 commented 2 years ago

I have used this to keep the Image small, maybe something for the docs too? :-)

apt-get -y --no-install-recommends install [package] && \
    apt-get purge -y wget && \
    apt-get autoremove -y && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

It's running fine with Debian so im closing this. Thanks for the help :-)

jlesage commented 2 years ago

You should use add-pkg to install packages. It does all the proper cleanup. See https://github.com/jlesage/docker-baseimage-gui#addingremoving-packages

Loader23 commented 2 years ago

Ooohhh, I always thought that only applies to the alpine Image^^ Thanks alot :-)