在 NGINX Docker 镜像上安装软件包后丢失文件

在 NGINX Docker 镜像上安装软件包后丢失文件

我正在Docker 映像(基于 Debian Bullseye)fcgiwrap上安装该软件包,但某些文件似乎丢失了。nginx这可能是显而易见的事情,但我找不到解释,这是我尝试过的一切:

1. 使用包构建 Docker 镜像

FROM nginx:latest

RUN apt-get update \
    && apt-get -q install -y \
    fcgiwrap \
    && rm -rf /var/lib/apt/lists/*

运行后(即docker run -it my-image /bin/bash),如果我列出,/usr/share/doc/fcgiwrap我只能看到一个copyright文件和空examples文件夹。

2.运行基础镜像并直接安装

docker run -it nginx /bin/bash然后apt install fcgiwrap,文件仍然丢失。

3. 运行基础镜像并安装dpkg

docker run -it nginx /bin/bash然后:

  1. apt-get install -d fcgiwrap
  2. cd /var/cache/apt/archives,显示:
fcgiwrap_1.1.0-12_amd64.deb    libfcgi0ldbl_2.4.2-2_amd64.deb  partial
libfcgi-bin_2.4.2-2_amd64.deb  lock                            spawn-fcgi_1.6.4-2_amd64.deb
  1. dpkg --contents fcgiwrap_1.1.0-12_amd64.deb,显示:
drwxr-xr-x root/root         0 2018-12-09 15:58 ./
drwxr-xr-x root/root         0 2018-12-09 15:58 ./etc/
drwxr-xr-x root/root         0 2018-12-09 15:58 ./etc/init.d/
-rwxr-xr-x root/root      7231 2016-07-09 22:42 ./etc/init.d/fcgiwrap
drwxr-xr-x root/root         0 2018-12-09 15:58 ./lib/
drwxr-xr-x root/root         0 2018-12-09 15:58 ./lib/systemd/
drwxr-xr-x root/root         0 2018-12-09 15:58 ./lib/systemd/system/
-rw-r--r-- root/root       273 2018-12-09 15:58 ./lib/systemd/system/fcgiwrap.service
-rw-r--r-- root/root       114 2018-12-09 15:58 ./lib/systemd/system/fcgiwrap.socket
drwxr-xr-x root/root         0 2018-12-09 15:58 ./usr/
drwxr-xr-x root/root         0 2018-12-09 15:58 ./usr/sbin/
-rwxr-xr-x root/root     26776 2018-12-09 15:58 ./usr/sbin/fcgiwrap
drwxr-xr-x root/root         0 2018-12-09 15:58 ./usr/share/
drwxr-xr-x root/root         0 2018-12-09 15:58 ./usr/share/doc/
drwxr-xr-x root/root         0 2018-12-09 15:58 ./usr/share/doc/fcgiwrap/
-rw-r--r-- root/root       825 2016-07-09 20:50 ./usr/share/doc/fcgiwrap/README.Debian
-rw-r--r-- root/root      3018 2018-12-09 15:58 ./usr/share/doc/fcgiwrap/changelog.Debian.gz
-rw-r--r-- root/root      1483 2017-08-05 16:19 ./usr/share/doc/fcgiwrap/copyright
drwxr-xr-x root/root         0 2018-12-09 15:58 ./usr/share/doc/fcgiwrap/examples/
-rw-r--r-- root/root       501 2016-07-09 22:42 ./usr/share/doc/fcgiwrap/examples/default
-rw-r--r-- root/root       229 2016-07-09 20:04 ./usr/share/doc/fcgiwrap/examples/monitrc
-rw-r--r-- root/root       648 2016-07-09 20:04 ./usr/share/doc/fcgiwrap/examples/nginx.conf
drwxr-xr-x root/root         0 2018-12-09 15:58 ./usr/share/man/
drwxr-xr-x root/root         0 2018-12-09 15:58 ./usr/share/man/man8/
-rw-r--r-- root/root      1785 2018-12-09 15:58 ./usr/share/man/man8/fcgiwrap.8.gz
  1. dpkg -i spawn-fcgi_1.6.4-2_amd64.deb
  2. dpkg -i libfcgi0ldbl_2.4.2-2_amd64.deb
  3. dpkg -i fcgiwrap_1.1.0-12_amd64.deb
  4. ls /usr/share/doc/fcgiwrap/显示:
copyright  examples
  1. cat /usr/share/doc/fcgiwrap/README.Debian显示:
cat: /usr/share/doc/fcgiwrap/README.Debian: No such file or directory

知道这里发生了什么吗?

答案1

我想我问得太早了,看起来有些 Docker 镜像默认禁用安装文档,使用类似于以下的规则:https://askubuntu.com/a/541061,在文件中/etc/dpkg/dpkg.cfg.d/docker

相关内容