DEV Community

vast cow
vast cow

Posted on

How to Use a Debian Trixie Docker Image with Wine

This Dockerfile creates a container based on Debian Trixie with Wine installed. The main purpose is to run Windows applications inside a Docker container using Wine.

Building the Docker Image

First, save the content as a file named Dockerfile.

Then build the image with:

docker build -t debian-wine .
Enter fullscreen mode Exit fullscreen mode

This command creates a Docker image named debian-wine that includes Wine Stable from the official WineHQ repository.

Running the Container

Start the container interactively:

docker run -it --rm debian-wine
Enter fullscreen mode Exit fullscreen mode

You will enter a Bash shell inside the container because the default command is:

CMD ["bash"]
Enter fullscreen mode Exit fullscreen mode

The working directory is /root.

Running Windows Applications

Inside the container, you can use Wine to run Windows executables:

wine your-program.exe
Enter fullscreen mode Exit fullscreen mode

If needed, you can copy files into the container:

docker run -it --rm -v $(pwd):/work debian-wine
Enter fullscreen mode Exit fullscreen mode

Then access them inside the container:

cd /work
wine your-program.exe
Enter fullscreen mode Exit fullscreen mode

This allows you to execute Windows applications stored on your host machine.

Key Points of Usage

  • The container includes both 64-bit and 32-bit support (i386 architecture enabled).
  • Wine Stable is installed from WineHQ.
  • The environment is non-interactive for smooth automated builds.
  • The image is cleaned to remain lightweight.

This setup provides a clean, isolated environment for running Windows software on a Linux system using Docker and Wine.

FROM debian:trixie 

ENV DEBIAN_FRONTEND=noninteractive 

# Base packages 
RUN apt-get update && \ 
    apt-get install -y --no-install-recommends \ 
        ca-certificates \ 
        wget \ 
        gnupg \ 
        && rm -rf /var/lib/apt/lists/* 

# Enable i386 architecture (required for Wine) 
RUN dpkg --add-architecture i386 

# WineHQ keyring 
RUN mkdir -pm755 /etc/apt/keyrings && \ 
    wget -O /etc/apt/keyrings/winehq-archive.key \ 
      https://dl.winehq.org/wine-builds/winehq.key 

# WineHQ repository (Trixie) 
RUN wget -NP /etc/apt/sources.list.d/ \ 
      https://dl.winehq.org/wine-builds/debian/dists/trixie/winehq-trixie.sources 

# Install Wine 
RUN apt-get update && \ 
    apt-get install -y --install-recommends \ 
        winehq-stable && \ 
    rm -rf /var/lib/apt/lists/* 

WORKDIR /root 
CMD ["bash"] 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)