Setting up wine x86 and x64 in a docker container running on ARM

Hey all,

Maybe I’m trying to tackle something that’s way too difficult, but what I’m trying to do is setup wine for x86 and x64 inside a docker container running on ARM.

Introduction

I’ve found a number of interesting posts:


https://wiki.debian.org/QemuUserEmulation
https://www.raspberrypi.org/forums/viewtopic.php?t=281532

I’ve already gotten normal x86/x64 containers working on docker using https://github.com/dbhi/qus .

The disadvantage here is that all code running inside the containers needs to be either x86 or x64 code since you’re emulating the whole container.

What I’d like to have is a setup where I can run a specific arm application which then calls some windows .exe files that are compiled with x86 or x64.

I’ve already gotten most of the separate parts working (e.g. running QEMU inside an ARM docker container to run linux code and running wine in an x86 container) but haven’t gotten them all together in one container.

The thing that came closest was the hangover project however there’s still some issues where it doesn’t support all .exe files:

This project has some advantages where it can switch between ARM and x86 / x64 during interop (or something like this, I’m probably a bit wrong but I’m too novice to exactly explain this :slight_smile:)

In my case I’m not really interested in these advantages and just having everything running in QEMU emulation once I call wine would be fine for me.

My progress

I’ve basically started following this guide:

When trying to convert these commands to docker run commands though I started to become stuck at the mount commands:
mount -t sysfs sys ./chroot-stretch-i386/sys/
mount: /root/chroot-stretch-i386/sys: permission denied.

I had to remove sudo in all commands though since sudo isn’t installed by default in the container. But since we’re running all commands under root this shouldn’t be a problem. So I’m not exactly sure why the mount command is failing.

Questions

What I don’t quite understand yet is why we need the whole chroot / debootstrap environment. Can’t we just install winex86/x64 inside the arm container and use qemu-user-static to simply run it in emulation?

Or do we need to do a manual compile of everything? (I’ve been reading on this on the wine forum but a wine compile with both 32 bit and 64 bit support doesn’t seem to be too straight forward either).

Goal

So yeah, basically my goal would be to have an ARM docker container where I can run (most) cli based windows applications (both x86 and x64).

Current progress on Dockerfile

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS base
WORKDIR /root
RUN apt-get update && apt-get install qemu qemu-user qemu-user-static binfmt-support debootstrap binutils -y
RUN debootstrap --foreign --arch i386 stretch ./chroot-stretch-i386 http://ftp.us.debian.org/debian
RUN mount -t sysfs sys ./chroot-stretch-i386/sys/
# RUN mount -t proc proc ./chroot-stretch-i386/proc/
# RUN mount --bind /dev ./chroot-stretch-i386/dev/
# RUN mount --bind /dev/pts ./chroot-stretch-i386/dev/pts/
# RUN mount --bind /dev/shm ./chroot-stretch-i386/dev/shm/
# RUN cp /usr/bin/qemu-i386-static ./chroot-stretch-i386/usr/bin/
# RUN chroot ./chroot-stretch-i386/ /debootstrap/debootstrap --second-stage

ENTRYPOINT ["/bin/bash"]

It basically fails on the first RUN mount … command.