Docker 中使用超级用户
•
Python
在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 /bin/bash
例如:
docker exec -u 0 -it d989639e3cb4 /bin/bash
然后直接使用apt,不需要加sudo
apt-get update && apt-get install -y openjdk-8-jre-headless
本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/c49be63a9d.html
