Docker : Cannot autolaunch D-Bus without X11 $DISPLAY – How to resolve

Here we are trying to have create a docker image for Airflow [airflow:2.3.1-python3.8 ] 

Dockerfile has the following

FROM apache/airflow:2.3.1-python3.8
USER root

When creating image getting an error as 

ERROR: failed to solve: apache/airflow:2.3.1-python3.8: error getting credentials – err: exit status 1, out: `Cannot autolaunch D-Bus without X11 $DISPLAY`

The error message suggests that there’s a problem with the D-Bus daemon and the lack of an X11 $DISPLAY environment variable.

To resolve this issue, you can try the following:

  1. Make sure you have the latest version of Docker installed.
  2. Ensure that your Docker daemon is running properly. You can check this by running docker info in your terminal.
  3. Log in to Docker Hub with the following command (replace <your_username> and <your_password> with your Docker Hub credentials):
docker login -u <your_username> -p <your_password>
  1. If you’re still experiencing issues, try pulling the image manually before building your Dockerfile:
docker pull apache/airflow:2.3.1-python3.8
  1. If none of the above solutions work, you can try updating your D-Bus configuration. Add the following line to your Dockerfile before the FROM directive to set the environment variable:

Dockerfile will be like

FROM apache/airflow:2.3.1-python3.8

USER root
  1. Build the Docker image again, and if the issue persists, there may be a problem with your Docker installation or system configuration. You might want to consider reinstalling Docker.
Author: user

Leave a Reply