以 root 用户身份运行 Openshift pod

ani*_*iti 2 openshift kubernetes

我正在尝试在 openshift pod 中安装 docker,如下所示。

sh-4.2$ yum install docker
Loaded plugins: ovl, product-id, search-disabled-repos, subscription-manager
ovl: Error while doing RPMdb copy-up:
[Errno 13] Permission denied: '/var/lib/rpm/.dbenv.lock'
You need to be root to perform this command.
sh-4.2$ id
uid=1001(1001) gid=0(root) groups=0(root)
sh-4.2$ 
Run Code Online (Sandbox Code Playgroud)

尝试应用以下 oc adm 策略 add-scc-to-user anyuid -z default

能否请你帮忙。

Dae*_*ark 7

You should specify "0" using "runAsUser" as follows. Because "anyuid" is using UID which is configured when an image builds if you do not specify the UID in your container. I think your image is build with 1001 UID initially as far as I can see the result.

     containers:
     - name: YOURCONTAINERNAME
       :
       securityContext:
           runAsUser: 0
Run Code Online (Sandbox Code Playgroud)