I'm creating two apps, master and slave, which communicate over d-bus. My apps work as expected when being run on the same host.
Now I want to move slave app to docker container and I'm having problem sharing d-bus session between host and container. Here's my Dockerfile:
FROM i386/ubuntu:16.04 VOLUME /run/user/1000/ ENV DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus RUN apt-get update RUN apt-get upgrade -y RUN apt-get install -y dbus #RUN apt-get install -y libnotify-bin #RUN apt-get install -y dbus-x11 RUN adduser -u 1000 myuser #COPY dbus.conf /etc/dbus-1/session.d/ USER 1000:1000 ENTRYPOINT ["dbus-daemon", "--session", "--print-address"]
/run/user/1000/bus is the value of my DBUS_SESSION_BUS_ADDRESS variable.
And i create container with
docker create --mount type=bind,source=/run/user/1000/bus,target=/run/user/1000/bus mycontainer
/run/user/1000/bus is visible from within the container but when the container is started it prints the address
unix:abstract=/tmp/dbus-iXrYzptYOX,guid=78a790f0f6a4387a39ac3d505da478a3and my apps cannot communicate.
If i add my dbus.conf to /etc/dbus-1/session.d/ in container and override
I get the message 'Failed to start message bus: Failed to bind socket "/run/user/1000/bus": Address already in use'
I'm not sure whether I'm even supposed to be starting dbus-daemon inside docker.
How can I make this work?