Docker 不允许使用 dpkg 命令安装

Docker 不允许使用 dpkg 命令安装

我正在尝试在运行的 prometheus docker 容器中安装 docker cron 包。我下载了 cron 包,但不知何故它不允许我这样做。我使用 wget 命令下载了 cron 包。此外,它不允许我配置 dpkg。

/prometheus # dpkg --configure
dpkg: can't open '/var/lib/dpkg/status': No such file or directory
/prometheus # dpkg -i cron_3.0pl1-127+deb8u1_amd64.deb
dpkg: can't open '/var/lib/dpkg/status': No such file or directory

现在,当我尝试lib/dpkg在文件夹中创建文件夹时/var/

/prometheus # mkdir /var/lib/dpkg
mkdir: can't create directory '/var/lib/dpkg': No such file or directory

我不明白我做错了什么。我没有看到任何磁盘空间问题或 inode 问题。

/prometheus # df -kh
Filesystem                Size      Used Available Use% Mounted on
overlay                  93.7G     43.4G     46.1G  48% /
tmpfs                    15.0G         0     15.0G   0% /dev
tmpfs                    15.0G         0     15.0G   0% /sys/fs/cgroup
/dev/xvdbs               98.3G     18.3G     75.0G  20% /prometheus
/dev/xvda1               93.7G     43.4G     46.1G  48% /dev/termination-log
/dev/xvda1               93.7G     43.4G     46.1G  48% /etc/prometheus
/dev/xvda1               93.7G     43.4G     46.1G  48% /etc/resolv.conf
/dev/xvda1               93.7G     43.4G     46.1G  48% /etc/hostname
/dev/xvda1               93.7G     43.4G     46.1G  48% /etc/hosts
shm                      64.0M         0     64.0M   0% /dev/shm
tmpfs                    15.0G     12.0K     15.0G   0% /var/run/secrets/kubernetes.io/serviceaccount
tmpfs                    15.0G         0     15.0G   0% /proc/kcore
tmpfs                    15.0G         0     15.0G   0% /proc/timer_list
tmpfs                    15.0G         0     15.0G   0% /proc/timer_stats
tmpfs                    15.0G         0     15.0G   0% /proc/sched_debug

/prometheus # df -i
Filesystem              Inodes      Used Available Use% Mounted on
overlay               26214400   5793478  20420922  22% /
tmpfs                  3925290        18   3925272   0% /dev
tmpfs                  3925290        15   3925275   0% /sys/fs/cgroup
/dev/xvdbs             6553600    177485   6376115   3% /prometheus
/dev/xvda1            26214400   5793478  20420922  22% /dev/termination-log
/dev/xvda1            26214400   5793478  20420922  22% /etc/prometheus
/dev/xvda1            26214400   5793478  20420922  22% /etc/resolv.conf
/dev/xvda1            26214400   5793478  20420922  22% /etc/hostname
/dev/xvda1            26214400   5793478  20420922  22% /etc/hosts
shm                    3925290         1   3925289   0% /dev/shm
tmpfs                  3925290         9   3925281   0% /var/run/secrets/kubernetes.io/serviceaccount
tmpfs                  3925290        18   3925272   0% /proc/kcore
tmpfs                  3925290        18   3925272   0% /proc/timer_list
tmpfs                  3925290        18   3925272   0% /proc/timer_stats
tmpfs                  3925290        18   3925272   0% /proc/sched_debug

我的容器中也没有用于/var/log/检查日志的文件夹。我是 root 用户,如下所示。它是 busybox 容器,因为 busybox 是 prometheus 使用的基础映像。

/etc/prometheus # whoami
root

运行mkdir -p /var/lib/dpkg命令后,我能够摆脱之前的错误消息,但却遇到新的错误。

/prometheus # dpkg -i cron_3.0pl1-127+deb8u1_amd64.deb
dpkg: package cron pre-depends on dpkg, which is not installed or flagged to be installed

相关内容