この記事は約2分29秒で読むことができます。

sudo user add docker oracle


[oracle@centos7 ~]$ docker exec -it orcl_12cr2 /bin/bash
[oracle@609a69bc0b21 ~]$ id
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)
[oracle@609a69bc0b21 ~]$ 

[oracle@centos7 ~]$ docker exec --interactive --tty --user root --workdir / orcl_12cr2 bash
bash-4.2# visudo
bash-4.2# exit

#--これはいけない
## Allows people in group wheel to run all commands
#%wheel ALL=(ALL)       ALL
oinstall ALL=(ALL)      ALL
#--これはいけるはず
## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL
oracle          ALL=(ALL)       ALL

[oracle@centos7 ~]$ docker exec -it orcl_12cr2 /bin/bash
[oracle@609a69bc0b21 ~]$ whoami
oracle
[oracle@609a69bc0b21 ~]$ id
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)
[oracle@609a69bc0b21 ~]$ sudo echo "hey"
[sudo] password for oracle: 
hey
[oracle@609a69bc0b21 ~]$ 

Leave a Reply

Your email address will not be published. Required fields are marked *