碼頭工人 |未知環境`bash` |子進程 /usr/bin/dpkg 傳回錯誤代碼(1)

碼頭工人 |未知環境`bash` |子進程 /usr/bin/dpkg 傳回錯誤代碼(1)

我的目標是讓 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 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 桌面安裝過程進展順利。

答案1

不確定您是否已經弄清楚,但安裝後腳本專門用於配置 systemd/sysvinit 腳本。由於您在 docker 容器內運行,因此您沒有這些。

對於好奇的人,該腳本會查看 PID 1 的進程來決定您是執行 systemd 還是 sysvinit。然而,由於這是在 docker 內部,PID 1 將屬於您傳遞給 docker 的任何命令(在本例中為 bash)。

您應該能夠安全地忽略該錯誤,因為該應用程式已安裝。

相關內容