anil panditi
anil panditi

Reputation: 51

Run Openshift pod as root user

I am trying to install docker inside an openshift pod like below.

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$ 

Tried applying following oc adm policy add-scc-to-user anyuid -z default

Could you please help.

Upvotes: 2

Views: 21985

Answers (1)

Daein Park
Daein Park

Reputation: 4683

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

Upvotes: 8

Related Questions