Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

585
Vistas
Run dbus-daemon inside Docker container

I am trying to create a Docker container with a custom D-Bus bus running inside.

I configured my Dockerfile as follow:

FROM ubuntu:16.04
COPY myCustomDbus.conf /etc/dbus-1/
RUN apt-get update && apt-get install -y dbus
RUN dbus-daemon --config-file=/etc/dbus-1/myCustomDbus.conf

After building, the socket is created but it is flagged as "file", not as "socket", and I can not use it as a bus...

-rwxrwxrwx  1 root root    0 Mar 20 07:25 myCustomDbus.sock

If I remove this file and run the dbus-daemon command again in a terminal, the socket is successfully created :

srwxrwxrwx  1 root root    0 Mar 20 07:35 myCustomDbus.sock

I am not sure if it is a D-Bus problem or a docker one.

about 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

Instead of using the "RUN" command, you should use the "ENTRYPOINT" one to run a startup script.

The Dockerfile should look like that :

FROM ubuntu:14.04
COPY myCustomDbus.conf /etc/dbus-1/
COPY run.sh /etc/init/
RUN apt-get update && apt-get install -y dbus
ENTRYPOINT ["/etc/init/run.sh"]

And run.sh :

#!/bin/bash
dbus-daemon --config-file=/etc/dbus-1/myCustomDbus.conf --print-address
about 4 years ago · Santiago Trujillo Denunciar

0

You should use a startup script. The "run" command is executed only when the container is created and then stopped.

about 4 years ago · Santiago Trujillo Denunciar

0

my run.sh:

if ! pgrep -x "dbus-daemon" > /dev/null
then
    # export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --config-file=/usr/share/dbus-1/system.conf --print-address | cut -d, -f1)

    # or:
    dbus-daemon --config-file=/usr/share/dbus-1/system.conf
    # and put in Dockerfile:
    # ENV DBUS_SESSION_BUS_ADDRESS="unix:path=/var/run/dbus/system_bus_socket"
else
    echo "dbus-daemon already running"
fi

if ! pgrep -x "/usr/lib/upower/upowerd" > /dev/null
then
    /usr/lib/upower/upowerd &
else
    echo "upowerd already running"
fi

then chrome runs with

--use-gl=swiftshader

without errors

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda