Console Application in Docker Container (Ubuntu vs. Alpine)

  1. 11 months ago

    Jürg O

    17 May 2019 Pre-Release Testers, Xojo Pro

    Has anyone managed to get a Xojo built console application running in a Docker Container using Alpine ?

    Alpine Linux is a Linux distribution built around musl libc and BusyBox. The image is only 5 MB in size and has access to a package repository that is much more complete than other BusyBox based images. This makes Alpine Linux a great image base for utilities and even production applications.

    When using Ubuntu as the base image, everything works pretty easily. Alpine would be great since it's much more lightweight.
    Just compare a dockerized cubeSQL : The Image size when using Ubuntu is 63MB, whereas with Alpine it's only 9MB.

    To test a Xojo Console Application in a Docker Container , I've been using Aloe Express Demo. See details in the linked Forum post.

    So for Ubuntu, it only takes to add a couple of required Libraries:

    #BASE IMAGE
    FROM ubuntu:18.04
    
    #INSTALL REQUIRED LIBRARIES
    ENV DEBIAN_FRONTEND noninteractive
    RUN apt-get update && apt-get install -y libunwind8 libglib2.0

    Alpine is quite different... since it's so lightweight, it seems that quite some more has to be installed. And it uses a different glibc variant (musl libc), which doesn't seem to work with running Xojo built apps.
    Alpine's libc6-compat and gcompat packages give even more errors (that's why it's commented out) than another popular glibc library.
    Here is what I've tried - but it still doesn't work because of some glibc issues...:

    #BASE IMAGE
    FROM alpine:3.9.4
    
    RUN apk update && apk add libstdc++ \
    #     libc6-compat \
    #     gcompat \
         libunwind \
         glib \
         curl
    
    RUN cd /tmp && \
        curl -L -o /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
        curl -L -O https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk && \
        curl -L -O https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-bin-2.29-r0.apk && \
        apk add glibc-2.29-r0.apk \
                glibc-bin-2.29-r0.apk && \
        rm /tmp/glibc-2.29-r0.apk && \
        rm /tmp/glibc-bin-2.29-r0.apk
    
    RUN cd /tmp && \
        curl -L -O https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-i18n-2.29-r0.apk && \
        apk add glibc-i18n-2.29-r0.apk && \
        rm /tmp/glibc-i18n-2.29-r0.apk && \
        /usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8
    
    ADD / /app/
    EXPOSE 4224
    WORKDIR /app
    CMD /app/aloe-express-demo

    This still complains about "symbols not found" (isinf, mallinfo, __isnan)...

    So for now it seems that I will continue to experiment with Ubuntu... but I'd love to use Alpine because of it's security and lightweight size.
    If anyone gets a Xojo built application running with Alpine Linux - please share how this can be done :)

  2. scott b

    17 May 2019 Pre-Release Testers, Xojo Pro local coffee shop

    @Jürg O Has anyone managed to get a Xojo built console application running in a Docker Container using Alpine ?

    no. Ubuntu, yes. strong no for alpine. I spent like 4 hours messing with alpine then decided that I want some hair left. switched to ubuntu bionic and it just worked (well I had to make sure I had all the right libs).

    I even got the Xojo IDE to launch in a Mint based container using the XVFB as the X server. And Mint is Ubuntu based. with a little playing I probably could of gotten Ubuntu Bionic to do the same thing but since the IDE is recommended on top of Mint I just went with that.

    I have not tried centos/fedora/CoreOS/etc either. so I cant say one way or another.

  3. Tim J

    17 May 2019 Pre-Release Testers, Xojo Pro N. Phoenix, AZ

    Well, "isinf" and "isnan"/"__isnan" are part of the built-in math functions in glibc, so you would need to look for a math library for the libc that Alpine provides. I can't find a provider for "mailinfo", but it's probably part of the larger lib packages that you get with a full Linux release.

  4. Jürg O

    17 May 2019 Pre-Release Testers, Xojo Pro

    @scott b I spent like 4 hours messing with alpine then decided that I want some hair left

    Same here :) But it would be so nice to have for running console apps (such as Aloe).

    @scott b witched to ubuntu bionic and it just worked

    yup, that'll have to do it - for now... but since I'm always curious - here I am asking :)

    @scott b I even got the Xojo IDE to launch in a Mint based container using the XVFB as the X server.

    Cool - I haven't come that far yet ;) Do you have a HowTo for that on your Blog by any chance?

    @Tim J Well, "isinf" and "isnan"/"__isnan" are part of the built-in math functions in glibc, so you would need to look for a math library for the libc that Alpine provides.

    I've guessed something like this (and therefore tried the other glibc library).
    It seems both Scott and me haven't found something useful (that works with Xojo built apps)... should anyone do - thanks for letting us know. Until then - Ubuntu (and probably also Debian) works just fine. Still - Alpine would be nice for some kind of Xojo-built console services... so I keep dreaming (and maybe trying more some other day), while using Ubuntu for now.

  5. scott b

    17 May 2019 Pre-Release Testers, Xojo Pro local coffee shop

    @Jürg O Cool - I haven't come that far yet ;) Do you have a HowTo for that on your Blog by any chance?

    short answer is no. the use case I was going for wasnt stable/reliable/repeatable so I ditched it. I have already talked to @Greg OLone about my issues/challenges and once they get addressed then I can return back to doing stuff inside containers.

or Sign Up to reply!