Dbus_bus_get: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

I am trying to get a D-bus program up in a container.
I created the release container image and deployed it to the Apalis iMX8 board.
When I try to run image using docker run -it from the command line, I get the error.
dbus_bus_get: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

Please can you advise?

Hi @SJ_BHD ,

I’m going to need more details about your setup.

  • What is the complete docker run command that you tried to execute? You probably need some bind mounts when running the container, like /var/run/dbus

  • What are you trying to run in the container exactly? Another dbus instance, or are you just trying to access the one already running in TorizonCore, outside of containers?

  • Are you trying to run a graphical application in a container? If so, you can try running a separate weston container and then access it through bind mounts, like done in this article: Web Browser / Kiosk Mode with TorizonCore | Toradex Developer Center. In this case the non-weston container has to have some environment variables set, like DISPLAY.

Best regards,
Lucas Akira

Hello Lucas,

I am trying to run Dbus inside 2 separate containers, and want these containers to communicate over D-bus. Not trying to run a graphical application yet.

The docker command that I invoked on the command line was : docker run -it container ID.

I have also tried running the container with the -v /var/run/dbus:/var/run/dbus options, however I still get the same error.

Hi @SJ_BHD !

To be really sure, could you share all the commands exactly how you are running, so we can better understand what you are trying to do?

Also, please share the Dockerfiles of your docker images.

The more information, the better :slight_smile:

Best regards,

Hello the commands used with the release container created were
“docker run containerID”
“docker run -v /var/run/dbus:/var/run/dbus containerID”
“docker run -it containeID”
“docker run -it -v /var/run/dbus:/var/run/dbus containerID”

I am using a simple server and client program in dbus, which when copied directly to the board work fine, however, I am trying to create both these programs in containers and want them to communicate via dbus.

Uploaded the docker files of both client and server.

Dockerfile (830 Bytes)
Dockerfile (830 Bytes)

Hi @SJ_BHD ,

Thanks for providing the files.

Did you ever hear about docker-compose? It lets you quickly start multiple containers while keeping a good overview of their configurations.

About the communication over D-Bus, could you check if the dbus service is running inside the containers by running the command service dbus status ?

Best Regards
Kevin

Hello Kevin,

I have also tried the following commands. Tried to use the system daemon instead of the session daemon for dbus.
“docker run -it --privileged -v /var/run/dbus:/var/run/dbus containerID”
“docker run --security-opt “apparmor:unconfined” -it -v /var/run/dbus:/var/run/dbus containerID”

However I am still getting error.
dbus_bus_get: Connection “:1.312” is not allowed to own the service “com.example.add_client” due to security policies in the configuration file.

Hi @SJ_BHD !

Can you please provide us with some minimal code that is able to reproduce the issue that you are facing? The Dockerfile as well.

The ones shared before are not usable: we cannot access the initial Docker Image (e.g. add-client_arm64v8-debian-no-ssh_bullseye_release_10d64962-2f4c-4c5b-b1c7-b421866a7aa8_sdk_image from on of your Dockerfiles)

Best regards,