docker |未知环境`bash`|子进程/usr/bin/dpkg返回错误代码(1)
我的目标是让docker容器在安装并连接nordvpn的情况下运行 启动docker容器docker |未知环境`bash`|子进程/usr/bin/dpkg返回错误代码(1),docker,ubuntu,debian,containers,dpkg,Docker,Ubuntu,Debian,Containers,Dpkg,我的目标是让docker容器在安装并连接nordvpn的情况下运行 启动docker容器 sudo docker pull ubuntu:latest sudo docker run -it ubuntu bash // now im in the docker container apt install update apt install wget wget {{nordvpn_link.deb}} dpkg -i {{nordvpn_link.deb}} // some errors ab
sudo docker pull ubuntu:latest
sudo docker run -it ubuntu bash
// now im in the docker container
apt install update
apt install wget
wget {{nordvpn_link.deb}}
dpkg -i {{nordvpn_link.deb}}
// some errors about dependencies after above command so ...
apt install -f
// then
apt install nordvpn
第一个大错误
root@f706a3f4012f:/home# apt install nordvpn
Reading package lists... Done
Building dependency tree
Reading state information... Done
nordvpn is already the newest version (3.6.0-2).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up nordvpn (3.6.0-2) ...
[ERROR] Unknown environment `bash'
dpkg: error processing package nordvpn (--configure):
installed nordvpn package post-installation script subprocess returned error exit status 255
Errors were encountered while processing:
nordvpn
E: Sub-process /usr/bin/dpkg returned an error code (1)
我读取以运行以下命令
dpkg --configure -a
// errors
Setting up nordvpn (3.6.0-2) ...
[ERROR] Unknown environment `bash'
dpkg: error processing package nordvpn (--configure):
installed nordvpn package post-installation script subprocess returned error exit status 255
Errors were encountered while processing:
nordvpn
我不知道为什么docker容器会出现这种情况,因为在我的常规ubuntu桌面安装过程中进展顺利。问题是
systemd
没有运行
在第5行的安装后脚本/var/lib/dpkg/info/nordvpn.postinst
中,它使用pid 1ENV=$(ps--no headers-o comm 1)
获取进程名称,在您的例子中是bash
而不是systemd
随后,它计算$ENV
,如果系统是用systemd
(或init
)启动的,则启动nordvpn服务,否则返回exit-1
请参见下面的代码段:
case "$ENV" in
init)
# snip
;;
systemd)
# snip
systemctl enable nordvpnd.socket &>/dev/null || :
systemctl enable nordvpnd.service &>/dev/null || :
systemctl start nordvpnd.socket &>/dev/null || :
systemctl start nordvpnd.service &>/dev/null || :
;;
*)
echo "[ERROR] Unknown environment \`$ENV'"
exit -1
;;
# snip
类似的问题:问题是
systemd
没有运行
在第5行的安装后脚本/var/lib/dpkg/info/nordvpn.postinst
中,它使用pid 1ENV=$(ps--no headers-o comm 1)
获取进程名称,在您的例子中是bash
而不是systemd
随后,它计算$ENV
,如果系统是用systemd
(或init
)启动的,则启动nordvpn服务,否则返回exit-1
请参见下面的代码段:
case "$ENV" in
init)
# snip
;;
systemd)
# snip
systemctl enable nordvpnd.socket &>/dev/null || :
systemctl enable nordvpnd.service &>/dev/null || :
systemctl start nordvpnd.socket &>/dev/null || :
systemctl start nordvpnd.service &>/dev/null || :
;;
*)
echo "[ERROR] Unknown environment \`$ENV'"
exit -1
;;
# snip
类似的问题:你是说
apt update
而不是apt install update
?在深入挖掘之后,我找到了安装后脚本/var/lib/dpkg/info/nordvpn.postinst。由于未安装systemd,因此失败。你在运行什么图像?@FrodeAkselsen我已经在ubuntu:18.04
和ubuntu:latest
上试过了;我发现最多的错误是未知环境bash
。我以前从未见过这种情况。@MattClendenen我改变了下面的答案来解释发生了什么,显然让systemd运行并不是那么简单。我想一定有其他解决方案可以让nordvpn在容器中运行。顺便说一句,我在这里提出了我自己的问题:但是让它更开放一点。你是说apt update
而不是apt install update
?在深入挖掘之后,我找到了安装后脚本/var/lib/dpkg/info/nordvpn.postinst。由于未安装systemd,因此失败。你在运行什么图像?@FrodeAkselsen我已经在ubuntu:18.04
和ubuntu:latest
上试过了;我发现最多的错误是未知环境bash
。我以前从未见过这种情况。@MattClendenen我改变了下面的答案来解释发生了什么,显然让systemd运行并不是那么简单。我想一定有其他解决方案可以让nordvpn在容器中运行。顺便说一句,我在这里提出了我自己的问题:但让它更开放一点。