Search code examples
linuxoracle-databasedockercontainersroot

Unable to log in as root in Oracle Linux Docker container


I am trying to edit some files in a docker container using docker exec -it container_Id bash

I am able to access the Commad line and the files but i can't login as root user.I tried all these commands :

root@Linux-Vostro-3250:~# docker exec -it MS1 bash
[oracle@b1c48eff3e2e base_domain]$ yum install nano
Loaded plugins: ovl
ovl: Error while doing RPMdb copy-up:
[Errno 13] Permission denied: '/var/lib/rpm/Requirename'
You need to be root to perform this command.
[oracle@b1c48eff3e2e base_domain]$ su
bash: su: command not found
[oracle@b1c48eff3e2e base_domain]$ sudo
bash: sudo: command not found
[oracle@b1c48eff3e2e base_domain]$ su -
bash: su: command not found
[oracle@b1c48eff3e2e base_domain]$ su-
bash: su-: command not found
[oracle@b1c48eff3e2e base_domain]$ 

Can someone help me with thiss..

Thanks a lot!!


Solution

  • docker exec supports a -u / --user option:

    docker exec -it -u root MS1 bash
    

    Source: Docs