docker+k8s 报错
docker+k8s报错问题点:docker容器中或者k8s的pod中执行systemctl相关后台服务报错信息:Failed to get D-Bus connection: Operation not permitted解决办法docker:运行容器添加参数–privileged=true + /sbin/initdocker run -tid --name text --privileged
·
docker+k8s报错
问题点:docker容器中或者k8s的pod中执行systemctl相关后台服务
报错信息:Failed to get D-Bus connection: Operation not permitted
解决办法
docker:运行容器添加参数–privileged=true + /sbin/init
docker run -tid --name text --privileged=true image_name /sbin/init
k8s:启动pod的yaml中添加参数:注意yaml格式的对齐
command: ["/usr/sbin/init", "-c","--"]
securityContext:
privileged: true
- 具体yaml
apiVersion: v1
kind: Pod
metadata:
name: text2
namespace: text
spec:
containers:
- name: text2
image: centos:7
command: ["/usr/sbin/init", "-c","--"]
securityContext:
privileged: true
总结:
1. 添加参数之后,container内的root拥有真正的root权限
2. 权限参数命令在init文件中
海汼部落原创文章,原文链接:http://www.hainiubl.com/topics/75603
更多推荐
已为社区贡献2条内容
所有评论(0)