docker容器中的nmcli [英] nmcli in a docker container

查看:407
本文介绍了docker容器中的nmcli的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在寻找在docker容器中运行nmcli

i currently looking for running nmcli in a docker container

nmcli在主机上运行良好,但是如果我要启动特权容器,nmcli将无法正常工作.

nmcli work great on my host but if i'm starting a privileged container nmcli does not work.

启动我的容器

sudo docker run --privileged --net host -it image_with_network-manager /bin/bash

然后运行nmcli

nmcli dev wifi  => Error: Could not create NMClient object: Could not connect: No such file or directory

容器中的ifconfig正常,我拥有主机的eth0和wlan0

ifconfig inside my container is ok , i have eth0 and wlan0 of the host

推荐答案

我这样运行容器:

docker run -d -it --privileged=true --net host --volume /var/run/dbus:/var/run/dbus [other args here]即可使用.

注意:--volume /var/run/dbus:/var/run/dbus而不是--volume /var/run/dbus,并且上面的音量共享标志用于共享 outer 系统的总线.如果您需要容器具有自己的总线,则需要进行其他配置.

Note: --volume /var/run/dbus:/var/run/dbus but not --volume /var/run/dbus, and the above volume sharing flag is used to share the outer system's bus. If you need the container to have its own bus, you will need to configure differently.

这篇关于docker容器中的nmcli的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆