在docker中安装keytool产生的问题:
sudo apt-get install openjdk-8-jre-headless
bash: sudo: command not found
elasticsearch@d989639e3cb4:~/config/certs$ apt-get install openjdk-8-jre-headless
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
elasticsearch@d989639e3cb4:~/config/certs$ sudo apt-get install openjdk-8-jre-headless
bash: sudo: command not found
elasticsearch@d989639e3cb4:~/config/certs$ su
Password:
su: Authentication failure
elasticsearch@d989639e3cb4:~/config/certs$ su
Password:
su: Authentication failure
elasticsearch@d989639e3cb4:~/config/certs$ apt-get update && apt-get install -y openjdk-8-jre-headless
Reading package lists... Done
E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)
elasticsearch@d989639e3cb4:~/config/certs$ exit
docker exec -u 0 -it <容器名称或ID> /bin/bash
例如:
docker exec -u 0 -it d989639e3cb4 /bin/bash
然后直接使用apt,不需要加sudo文章来源:https://www.toymoban.com/news/detail-819758.html
apt-get update && apt-get install -y openjdk-8-jre-headless文章来源地址https://www.toymoban.com/news/detail-819758.html
到了这里,关于Docker 中使用超级用户的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!