Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
  • RHEL7 Container root access

    Posted on

    Hi,

    I have created a pod using below yaml:

    apiVersion: v1
    kind: Pod
    metadata:
      name: pod
    
    spec:
      containers:
        - name: rhelc-7
          image: 'registry.redhat.io/rhel7'
          command: [ "/bin/bash" , "-c" ]
          args: [ "sleep infinity" ]
    
      imagePullSecrets:
          - name: secret
    

    However, when I connect to this pod, I am unable to get root access.
    su - root asks for password which is not mentioned anywhere
    sudo command is not available

    How can I switch to root as I need to install a package while creating the pod. Error while using yum install -y package-name:

    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.
    

    by

    points

    Responses

    Red Hat LinkedIn YouTube Facebook X, formerly Twitter

    Quick Links

    Help

    Site Info

    Related Sites

    © 2026 Red Hat