Same Dockerfile that works on native Ubuntu 22.04.3 LTS does not work on Windows 11 Docker under WSL2

I have a Dockerfile that uses a Rocky Linux 8 image that works perfectly fine under a Native Ubuntu 22.04.3 system, but fails on Windows 11 Docker Ubuntu under WSL2.

The error I get when building the image is:


0.946 Error:
0.946  Problem: cannot install the best candidate for the job
0.946   - nothing provides dbus-daemon = 1:1.12.8-24.el8_8.1 needed by dbus-devel-1:1.12.8-24.el8_8.1.x86_64
0.946 (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
------
Dockerfile:45
--------------------
  44 |     #
  45 | >>> RUN dnf -y install autoconf wayland-devel wayland-protocols-devel cairo-devel \
  46 | >>>                 libxkbcommon-devel dbus-devel mesa-libGLU-devel gtk3-devel
  47 |
--------------------
ERROR: failed to solve: process "/bin/sh -c dnf -y install autoconf wayland-devel wayland-protocols-devel cairo-devel \t\t   libxkbcommon-devel dbus-devel mesa-libGLU-devel gtk3-devel" did not complete successfully: exit code: 1

------------------------------ Dockerfile --------------------------------------

# syntax=docker/dockerfile:1

FROM rockylinux:8

# LABEL about the custom image
LABEL maintainer="ggarra13@gmail.com"
LABEL description="This is a custom Docker Image for mrv2."

#
# Install repositories
#
RUN dnf -y install dnf-plugins-core epel-release
RUN dnf config-manager --set-enabled powertools

#
# Update dnf database
#
RUN dnf makecache --refresh

#
# Install bundles
#
RUN dnf -y groupinstall "Development Tools" \
    && dnf -y install perl perl-CPAN
    
# Install IPC::Cmd non-interactively
RUN cpan App::cpanminus && cpanm --notest IPC::Cmd

#
# Install dependencies
#
RUN dnf -y install git wget cmake pango-devel gettext ninja-build \
		   libglvnd-devel alsa-lib-devel pulseaudio-libs-devel \
		   libXScrnSaver-devel dpkg doxygen zlib-devel libffi-devel \
		   openssl-devel tk-devel tcl-devel swig subversion
		   
#
# Install USD dependencies
#
RUN dnf -y install python39 libXt-devel

#
# Install Wayland dependencies
#
RUN dnf -y install autoconf wayland-devel wayland-protocols-devel cairo-devel \
		   libxkbcommon-devel dbus-devel mesa-libGLU-devel gtk3-devel

#
# Set Work Directory (where we put the repository)
#
WORKDIR /src

#
# Copy the package extract script to root
#
COPY ./etc/entrypoint.sh /entrypoint.sh

# Make Executable
RUN chmod +x /entrypoint.sh

RUN chmod a+rwx /src

ENTRYPOINT ["/entrypoint.sh"]

Please, format your post according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.

I apologize for the bad post. When I first posted my email, I did not have the standard buttons and it would not allow me to edit the post afterwards, either. I think it was a temporary glitch, as now it works perfectly.

Your post was marked by the spam filter. I guess that’s why you couldn’t edit until I accepted it (edit: or maybe I remember wrong, as I don’t see any flag on your post). Thank you for editing it now.

So it looks like you want to install dependencies that require special privileges. When you are working with contaiers, you an’t always use the same installer as you would outside containers. Some applications for example depend on Systemd which is also something that Docker images usually don’t have, but there are other ways to install apps usually.

In your case dbus-devel requires communicating with dbus on the host, and it can’t. Are you sure you need that package? What is that you really need to run in the container that required dbus-devel?

It is possible that you need a virtual machine and not a container.

According to FLTK 1.4’s docs, for README.Wayland:

  • libdbus-1-dev <== recommended to query current cursor theme

What I run in the container is a C++ compilation of an opengl player and viewer for the vfx and animation industries:

FLTK 1.4 repository (where README.Wayland resides):

My actual application with Build Instructions (takes about 25 mins to compile on a 16 cpu box):

I run the compilation in a Rocky Linux 8 container which allows me to create binaries that are compatible with RH8+ and Ubuntu 20+.

I don’t know if you solved it in the meantime, but I came back though my bookmarks where I saved this topic since I was too tired for thinking about things I don’t normally use :slight_smile:

So now I reread the topic title and also read about DBus a little.

So one thing I somehow managed misunderstand last time is that you were talking about native Linux vs WSL2 on Windows and not running something on the host vs in a container.

The other misunderstood part was that the error message is not about not being able to communicate with the dbus daemon, but the dbus-devel package has a dependency which is not available.

So if you use the same Dockerfile on Ubuntu and in WSL2, the package manages should work the same way, but one thing I have notices is that you use the tag rockylinux:8 which could be different versions of Rocky Linux depending on when you pulled the image.

I also found this which is about AlmaLinux, but the reason of the error message could be similar in combination with with a wrong rockylinux version:

If it was indeed similar, you might have solved it by now just by running the build again.

I tried it again and indeed it works now. This is great! I was previously having to dual boot on Windows and Linux to compile my program. You guys rock!

This is my first time with Docker. What should I use to get a consistant version instead of rockylinux:8? I would like to compile with rocky linux 8.1 (latest) or a similar Red Hat (free) derivative. This is to get the most compatibility across Linux versions.

Just never miss to read the image descriptions which mentions supported image tags :slight_smile:

https://hub.docker.com/_/rockylinux

I would use rockylinux:8.8 at least but you can also add the date: rockylinux:8.8.20230518

If you want an older tag (which is not supported), just go to the “tags” tab and search for it.