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

Container immediately exits #25

Closed calgara12 closed 2 years ago

calgara12 commented 5 years ago

Hey, I want to run a wine application with this docker image. But when i start the container, it exits immediately.

This is my Dockerfile:

FROM jlesage/baseimage-gui:debian-9
RUN \
        dpkg --add-architecture i386 && \
        apt update && \
        apt install -y  \
                        mono-complete \
                        wget \
                        wine 

COPY startapp.sh /startapp.sh
COPY ./randomwindowsapp /app
ENV APP_NAME="Crystaltile2"

This is my startapp.sh:

#!/bin/sh
/usr/bin/wine /app/randomwindowsapp.exe

Do you know what im doing wrong here? Thanks!

jlesage commented 5 years ago

Is there any output from the app? It's probably /usr/bin/wine /app/randomwindowsapp.exe that's failing.

cnstark commented 4 years ago

I met the same error when I use https://github.com/wszqkzqk/deepin-wine-ubuntu to install wine app

jlesage commented 4 years ago

Which error exactly ?

calgara12 commented 4 years ago

Hey, i just came back to this, and i still have the same problem.

Here is my Dockerfile, i used mkvcleaver as a template since this also uses wine:

#
# pk3DS Dockerfile
#
# https://github.com/jlesage/docker-pk3DS
#

# Pull base image.
FROM jlesage/baseimage-gui:alpine-3.9-v3.5.2

# Define software versions.
ARG pk3DS_VERSION=0800

# Define software download URLs.
ARG pk3DS_URL=https://dev.azure.com/project-pokemon/71d7fbaa-127c-489f-9ead-c1c4f0170bb4/_apis/build/builds/2222/artifacts?artifactName=pk3DS&api-version=6.0&%24format=zip

# Define working directory.
WORKDIR /tmp

# Install Wine.
RUN \
    add-pkg \
        wine-libs \
        wine

RUN \ 
    add-pkg \
        unzip

# Install pk3DS
RUN \
    add-pkg --virtual build-dependencies curl procps grep && \

    echo "Downloading pk3DS..." && \
    mkdir /opt/pk3DS && \
    wget -O pk3DS.zip ${pk3DS_URL} && \
    unzip pk3DS.zip -d /opt && \
    chmod 644 /opt/pk3DS/pk3DS.exe && \

    echo "Starting X server..." && \
    (/usr/bin/Xvfb :0 &) && \
    while ! xdpyinfo -display :0 > /dev/null 2>&1; do sleep 1; done && \

    echo "Installing pk3DS..." && \
    # Since we are using the portable version, we just need to launch the
    # executable and wait until it extracts its files.
    # NOTE: WINEDLLOVERRIDES is needed to avoid prompts about installing
    # mono and greko.
    (env WINEPREFIX=/opt/pk3DS WINEDLLOVERRIDES="mscoree,mshtml=" wine64 /opt/pk3DS/pk3DS.exe &) && \

    # Cleanup.
    del-pkg build-dependencies && \
    rm -rf /tmp/* /tmp/.[!.]*

# Adjust the openbox config.
RUN \
    # Maximize only the main/initial window.
    sed-patch 's/<application type="normal">/<application type="normal" title="pk3DS *">/' \
        /etc/xdg/openbox/rc.xml && \
    # Make sure the main window is always in the background.
    sed-patch '/<application type="normal" title="pk3DS \*">/a \    <layer>below</layer>' \
        /etc/xdg/openbox/rc.xml

# Generate and install favicons.
RUN \
    APP_ICON_URL=https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Nintendo-3DS-AquaOpen.png/1920px-Nintendo-3DS-AquaOpen.png && \
    install_app_icon.sh "$APP_ICON_URL"

# Add files.
COPY rootfs/ /

# Set environment variables.
ENV APP_NAME="pk3DS" \
    WINEPREFIX=/opt/pk3DS

# Define mountable directories.
VOLUME ["/config"]
VOLUME ["/storage"]

my startapp.sh:

#!/bin/sh
exec /bin/usr/wine64 /opt/pk3DS/pk3DS.exe

and my pk3ds.sh in /etc/cont-init.d

#!/usr/bin/with-contenv sh
# Make sure mandatory directories exist.
mkdir -p /config/temp

# Wine requires the WINEPREFIX directory to be owned by the user running the
# Windows app.
chown $USER_ID:$GROUP_ID "$WINEPREFIX"

# Take ownership of the config directory content.
find /config -mindepth 1 -exec chown $USER_ID:$GROUP_ID {} \;

# vim: set ft=sh :

I then build the image with docker-build calgara12/pk3ds:dev .

Then i run it with

docker run --rm -p 5805:5800 calgara12/pk3ds:dev

And this is the output i get. Everything seems to start up, but also exit immediately afterwards:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-app-niceness.sh: executing...
[cont-init.d] 00-app-niceness.sh: exited 0.
[cont-init.d] 00-app-script.sh: executing...
[cont-init.d] 00-app-script.sh: exited 0.
[cont-init.d] 00-app-user-map.sh: executing...
[cont-init.d] 00-app-user-map.sh: exited 0.
[cont-init.d] 00-clean-logmonitor-states.sh: executing...
[cont-init.d] 00-clean-logmonitor-states.sh: exited 0.
[cont-init.d] 00-clean-tmp-dir.sh: executing...
[cont-init.d] 00-clean-tmp-dir.sh: exited 0.
[cont-init.d] 00-set-app-deps.sh: executing...
[cont-init.d] 00-set-app-deps.sh: exited 0.
[cont-init.d] 00-set-home.sh: executing...
[cont-init.d] 00-set-home.sh: exited 0.
[cont-init.d] 00-take-config-ownership.sh: executing...
[cont-init.d] 00-take-config-ownership.sh: exited 0.
[cont-init.d] 00-xdg-runtime-dir.sh: executing...
[cont-init.d] 00-xdg-runtime-dir.sh: exited 0.
[cont-init.d] 10-certs.sh: executing...
[cont-init.d] 10-certs.sh: exited 0.
[cont-init.d] 10-cjk-font.sh: executing...
[cont-init.d] 10-cjk-font.sh: exited 0.
[cont-init.d] 10-nginx.sh: executing...
[cont-init.d] 10-nginx.sh: exited 0.
[cont-init.d] 10-vnc-password.sh: executing...
[cont-init.d] 10-vnc-password.sh: exited 0.
[cont-init.d] 10-web-index.sh: executing...
[cont-init.d] 10-web-index.sh: exited 0.
[cont-init.d] mkvcleaver.sh: executing...
[cont-init.d] mkvcleaver.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] starting s6-fdholderd...
[services.d] starting nginx...
[services.d] starting xvfb...
[nginx] starting...
[xvfb] starting...
[services.d] starting wineserver...
[services.d] starting x11vnc...
[services.d] starting logmonitor...
[x11vnc] starting...
[services.d] starting certsmonitor...
19/09/2020 08:17:05 passing arg to libvncserver: -rfbport
19/09/2020 08:17:05 passing arg to libvncserver: 5900
19/09/2020 08:17:05 passing arg to libvncserver: -rfbportv6
19/09/2020 08:17:05 passing arg to libvncserver: -1
19/09/2020 08:17:05 passing arg to libvncserver: -httpportv6
19/09/2020 08:17:05 passing arg to libvncserver: -1
19/09/2020 08:17:05 passing arg to libvncserver: -desktop
19/09/2020 08:17:05 passing arg to libvncserver: pk3DS
19/09/2020 08:17:05 x11vnc version: 0.9.14 lastmod: 2015-11-14  pid: 753
[services.d] starting statusmonitor...
[services.d] starting openbox...
[logmonitor] no file to monitor: disabling service...
[statusmonitor] no file to monitor: disabling service...
[wineserver] starting...
19/09/2020 08:17:05 Using X display :0
19/09/2020 08:17:05 rootwin: 0x43 reswin: 0x200001 dpy: 0xa9a89e0
19/09/2020 08:17:05
19/09/2020 08:17:05 ------------------ USEFUL INFORMATION ------------------
[certsmonitor] disabling service: secure connection not enabled.
[openbox] starting...
19/09/2020 08:17:05 X DAMAGE available on display, using it for polling hints.
19/09/2020 08:17:05   To disable this behavior use: '-noxdamage'
19/09/2020 08:17:05
19/09/2020 08:17:05   Most compositing window managers like 'compiz' or 'beryl'
19/09/2020 08:17:05   cause X DAMAGE to fail, and so you may not see any screen
19/09/2020 08:17:05   updates via VNC.  Either disable 'compiz' (recommended) or
19/09/2020 08:17:05   supply the x11vnc '-noxdamage' command line option.
19/09/2020 08:17:05 X COMPOSITE available on display, using it for window polling.
19/09/2020 08:17:05   To disable this behavior use: '-noxcomposite'
19/09/2020 08:17:05
19/09/2020 08:17:05 Wireframing: -wireframe mode is in effect for window moves.
19/09/2020 08:17:05   If this yields undesired behavior (poor response, painting
19/09/2020 08:17:05   errors, etc) it may be disabled:
19/09/2020 08:17:05    - use '-nowf' to disable wireframing completely.
19/09/2020 08:17:05    - use '-nowcr' to disable the Copy Rectangle after the
19/09/2020 08:17:05      moved window is released in the new position.
19/09/2020 08:17:05   Also see the -help entry for tuning parameters.
19/09/2020 08:17:05   You can press 3 Alt_L's (Left "Alt" key) in a row to
19/09/2020 08:17:05   repaint the screen, also see the -fixscreen option for
19/09/2020 08:17:05   periodic repaints.
19/09/2020 08:17:05 GrabServer control via XTEST.
19/09/2020 08:17:05
19/09/2020 08:17:05 Scroll Detection: -scrollcopyrect mode is in effect to
19/09/2020 08:17:05   use RECORD extension to try to detect scrolling windows
19/09/2020 08:17:05   (induced by either user keystroke or mouse input).
19/09/2020 08:17:05   If this yields undesired behavior (poor response, painting
19/09/2020 08:17:05   errors, etc) it may be disabled via: '-noscr'
19/09/2020 08:17:05   Also see the -help entry for tuning parameters.
19/09/2020 08:17:05   You can press 3 Alt_L's (Left "Alt" key) in a row to
19/09/2020 08:17:05   repaint the screen, also see the -fixscreen option for
19/09/2020 08:17:05   periodic repaints.
19/09/2020 08:17:05
19/09/2020 08:17:05 XKEYBOARD: number of keysyms per keycode 7 is greater
19/09/2020 08:17:05   than 4 and 51 keysyms are mapped above 4.
19/09/2020 08:17:05   Automatically switching to -xkb mode.
19/09/2020 08:17:05   If this makes the key mapping worse you can
19/09/2020 08:17:05   disable it with the "-noxkb" option.
19/09/2020 08:17:05   Also, remember "-remap DEAD" for accenting characters.
19/09/2020 08:17:05
19/09/2020 08:17:05 X FBPM extension not supported.
Xlib:  extension "DPMS" missing on display ":0".
19/09/2020 08:17:05 X display is not capable of DPMS.
19/09/2020 08:17:05 --------------------------------------------------------
19/09/2020 08:17:05
19/09/2020 08:17:05 Default visual ID: 0x21
19/09/2020 08:17:05 Read initial data from X display into framebuffer.
19/09/2020 08:17:05 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/5120
19/09/2020 08:17:05
19/09/2020 08:17:05 X display :0 is 32bpp depth=24 true color
19/09/2020 08:17:05
19/09/2020 08:17:05 Listening for VNC connections on TCP port 5900
19/09/2020 08:17:05
19/09/2020 08:17:05 Xinerama is present and active (e.g. multi-head).
19/09/2020 08:17:05 Xinerama: number of sub-screens: 1
19/09/2020 08:17:05 Xinerama: no blackouts needed (only one sub-screen)
19/09/2020 08:17:05
19/09/2020 08:17:05 fb read rate: 1591 MB/sec
19/09/2020 08:17:05 fast read: reset -wait  ms to: 10
19/09/2020 08:17:05 fast read: reset -defer ms to: 10
19/09/2020 08:17:05 The X server says there are 10 mouse buttons.
19/09/2020 08:17:05 screen setup finished.
19/09/2020 08:17:05

The VNC desktop is:      c5ed7d9d3aaa:0
PORT=5900

******************************************************************************
Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?

The scheme stores pixel data offscreen on the VNC viewer side for faster
retrieval.  It should work with any VNC viewer.  Try it by running:

    x11vnc -ncache 10 ...

One can also add -ncache_cr for smooth 'copyrect' window motion.
More info: http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching

[services.d] starting app...
[app] starting pk3DS...
[services.d] done.
[services.d] stopping services
[services.d] stopping app...
[services.d] stopping openbox...
[services.d] stopping statusmonitor...
[services.d] stopping certsmonitor...
[services.d] stopping logmonitor...
[services.d] stopping x11vnc...
caught signal: 15
19/09/2020 08:17:07 deleted 40 tile_row polling images.
[services.d] stopping wineserver...
[services.d] stopping xvfb...
[services.d] stopping nginx...
[services.d] stopping s6-fdholderd...
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] syncing disks.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.

Do you have any ideas why this could be happening

jlesage commented 4 years ago

You might have to run the app manually to see what is happening. Put while true;do sleep 60;done in your startapp.sh. This way, the container won't stop when you execute it, which will allow you to login to the container and manually invoke your app.

jlesage commented 2 years ago

Closing this issue. Please re-open if needed.