在使用docker for windows开启saltstack容器的时候,执行以下语句报错

[root@2ca3658133ab /]# systemctl start salt-master
Failed to get D-Bus connection: Operation not permitted

搜索后发现,在开启容器的时候需要加上特权privileged=true,且需要在加上/user/sbin/init

于是楼主这么改的

lisong01@lisong0100 MINGW64 ~/Desktop $ docker run -dit --privileged=true --name saltmaster saltstack/centos-7-minimal /usr/sbin/init
ff6c588a2eda07acd1972c68a04da74f95789e3dc970a1b175dc6d34d4a68326
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"C:/Program Files/Git/usr/sbin/init\": stat C:/Program Files/Git/usr/sbin/init: no such file or directory": unknown.

马丹,继续搜,看到这个文章https://www.cnblogs.com/Dev0ps/p/8335367.html

修改为 


lisong01@lisong0100 MINGW64 ~/Desktop
$ docker run -dit --privileged=true --name saltmaster saltstack/centos-7-minimal init
ba665f5a95f00d828684debc53874b875362122562bbb3a0c89b3c8a0e5a35c8

然后进入容器

lisong01@lisong0100 MINGW64 /
$ winpty docker exec -it ba66 bash
[root@ba665f5a95f0 /]# systemctl start salt-master

done!

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐