ENOENT when executing AppImage inside Docker container

I have an appimage that I want to run with --appimage-extract-and-run inside a docker container. When inside the docker container I cannot extract the appimage (fails with bash: ./prog.AppImage: No such file or directory

  • I tried extracting the appimage outside of the container on the same machine and it works.
  • I tried extracting the appimage inside of the container on a different machine and it works. I know this points to the first machine being the problem, but I don’t know enough to diagnose this.

Inside the container on the first machine I’ve done the following debugging commands:

$ file prog.AppImage
prog.AppImage: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, stripped
$ ls -al /lib64/ld-linux-x86-64.so.2
lrwxrwxrwx 1 root root 42 May  6 20:34 /lib64/ld-linux-x86-64.so.2 -> /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
$ uname -p
x86_64
$ strace ./prog.appimage --appimage-extract-and-run
execve("./prog.AppImage", ["./prog.AppImage", "--appimage-extract-and-run"], 0x7ffdf35c58f8 /* 8 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory
+++ exited with 1 +++
$ ldd prog.AppImage 
        not a dynamic executable

I cannot share the actual appimage that I’m using but I’m able to reproduce the issue using the Subsurface appimage (Subsurface Current Release)

And here is the Dockerfile I’m using:

# # # # #
# This image will built in the pipeline and used to execute E2E tests.
from ubuntu:22.04

run apt update && apt install -y curl build-essential
run curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
    && apt-get install -y nodejs
run npm install -g yarn
# xvfb allows graphical applications to run in a container without needing to be connected to a real display.
run apt install -y xvfb
# needed to run chromedriver
run apt install -y libglib2.0-0 libnss3
# needed to run chromium
run apt update
run apt install -y libatk-bridge2.0-0 libcups2 libgtk-3-0 libgbm1 libasound2
#needed for lithos
run apt install -y policykit-1 sudo
run mkdir -p /etc/udev/rules.d
run mkdir --mode=777 /data

# electron doesn't like running as root so we make a user.
# pkexec doesn't like running in docker so we make a fake pkexec
# by allowing our user to have passwordless sudo and making a
# link to sudo called pkexec.
run adduser --disabled-password --gecos "" testautomation \
 && usermod -aG sudo testautomation \
 && echo "testautomation ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
 && rm /usr/bin/pkexec \
 && ln -s /usr/bin/sudo /usr/bin/pkexec
user testautomation
workdir /home/testautomation

# The empty entrypoint allows the GitlabCI runner to start the container and send the script for the job.
entrypoint [""]