在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
apt-get update && apt-get install -y openjdk-8-jre-headless