Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
665 views
in Technique[技术] by (71.8m points)

dbus - D-BUS communication between lxc and host

I am recently made communication client-server app betweeen two diferent Linux users. For that, I used system d-bus. In direcory "/etc/dbus-1/system.d" I made configuration file for system d-bus and put in that directory. In configuration file I set own two users on one d-bus interface. After that, communication between two linux users it worked.

The my next step is accomplish a communication client-server app between host (my primarly user) and lxc container (based on ubuntu). In that case, exists is one file system_bus_socket which is intended for host machine and exists second file system_bus_socket which intended for lxc machine. My question is: How to hook up on system_bus_socket (host machine) from lxc container? I tried to mount dir from host /var/run/dbus to lxc /var/run/dbus, but it didn't work.

I hope that you understand me.

question from:https://stackoverflow.com/questions/65830186/d-bus-communication-between-lxc-and-host

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can create a LXD proxy device to link a Unix socket on the host and a Unix socket in a container.

Here is how the command line should look like:

lxc config device add mycontainer mysocket proxy connect=unix:/var/on/the/host listen=unix:/var/in/the/container bind=container

Documentation: https://github.com/lxc/lxd/blob/master/doc/instances.md#type-proxy


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...