docker安装weblogic用root进入时出现chdir to cwd /u01/oracle permission denied unknown

"chdir to cwd (\"/u01/oracle\") set in config.json failed: permission denied": unknown

出现这个问题我在国内的网址找不到任何答案,但是通过google找到了正确的答案

请自行穿越到国外查看此网址

https://rmoff.net/2018/11/30/logging-in-as-root-on-oracle-database-docker-image/

具体内容如下所示,我已经复制过来了

Logging in as root on Oracle Database Docker image

Published Nov 30, 2018 in OracleDockerSudoRoot

tl;dr:

docker exec --interactive \
            --tty \
            --user root \
            --workdir / \
            oracle-container-name bash

Using Oracle’s Docker database image I wanted to install some additional apps, without modifying the Dockerfile.

Connect to the container:

$ docker exec --interactive --tty docker-compose_oracle_1_479e7fa05ab5 bash

No sudo:

[oracle@a37d6e99353b ~]$ sudo whoami
bash: sudo: command not found

Googled, found the the --user flag for Docker, tried that:

$ docker exec --interactive --tty --user root docker-compose_oracle_1_479e7fa05ab5 bash
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "chdir to cwd (\"/home/oracle\") set in config.json failed: permission denied": unknown

Evidently, the Docker image tries to change directory to the Oracle home folder which Docker’s not happy doing as another user (even though it’s root?).

Googled some more, found the --workdir flag to override the WORKDIR setting of the Dockerfile from which the image is built:

$ docker exec --interactive --tty --user root --workdir / docker-compose_oracle_1_479e7fa05ab5 bash
bash-4.2# whoami
root

答案就在最后一行

docker exec --interactive --tty --user root --workdir / docker-compose_oracle_1_479e7fa05ab5 bash

 这样就可以进入到root权限了,因为部署一些东西需要将文件上传到weblogic容器中,但是docker cp的操作不能改变root权限,通过exec 进入到容器会发现是oracle的用户,你无法su root也没有密码,所以只能通过上面的方式进行,然后将文件的权限通过chown -R oracle:oracle [文件夹]  进行修改,然后再进行部署操作,不得不说国内网站真的是很少人遇到这样的问题,或者说是将自己的答案分享到某个地方,希望更多的人能够写一下博客来共享自己的经验。

打赏二维码,多谢支持

 

 

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值