Debian

在 NGINX Docker 映像上安裝軟體包後失去文件

  • January 3, 2022

我正在 Docker 映像上安裝fcgiwrap軟體包nginx(基於 Debian Bullseye),並且某些文件似乎失去了。這可能是顯而易見的,但我找不到解釋,這是我嘗試過的一切:

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

知道這裡發生了什麼嗎?

我想我問得太早了,看起來一些 Docker 映像預設禁用安裝文件,使用類似於以下規則:https://askubuntu.com/a/541061,在文件中/etc/dpkg/dpkg.cfg.d/docker

引用自:https://unix.stackexchange.com/questions/684774