简体   繁体   中英

`lsb_release -a` inside an `opensuse/tumbleweed` docker

Context

When trying to install a python3 package using

python3 -m pip install absl-py

It fails if lsb-release package is installed (which is my case and mandatory).

After digging I've found, pip will internally call lsb_release -a which will lead to this error... I can easily reproduce it using the following Dockerfile

Protocol

Create this Dockerfile :

# ref: https://hub.docker.com/r/opensuse/tumbleweed
FROM opensuse/tumbleweed

RUN zypper update -y \
&& zypper install -y lsb-release \
&& zypper clean -a

RUN lsb_release -a

Observed

docker build --tag=so .
...
 ---> 8330cfe918d5
Step 3/3 : RUN lsb_release -a
 ---> Running in 488762fb27a3
/usr/bin/lsb_release: line 122: getopt: command not found
The command '/bin/sh -c lsb_release -a' returned a non-zero code: 2

Tests

I've tried to install "gengetopt", "gnu-getopt" or "perl-Getopt-Long-Descriptive" without success (ed still the same error occurred).

Workaround

One workaround is to install the meta package lsb unfortunately it take time (184 packages).

I'm looking for a "smaller" package to fix it (ie pulling less dependencies).

Protocol

FROM opensuse/tumbleweed

RUN zypper update -y \
&& zypper install -y lsb-release \
&& zypper clean -a

RUN zypper update -y \
&& zypper install -y lsb \
&& zypper clean -a

RUN lsb_release -a

Observed

docker build --tag=workaround .
...
Step 4/4 : RUN lsb_release -a
 ---> Running in 6d93c78f7a47
LSB Version:    core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-x86_64:core-3.2-x86_64:core-4.0-x86_64:desktop-4.0.fake-amd64:desktop-4.0.fake-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.2-amd64:graphics-3.2-noarch:graphics-4.0.fake-amd64:graphics-4.0.fake-noarch
Distributor ID: openSUSE
Description:    openSUSE Tumbleweed
Release:    20201121
Codename:   n/a
Removing intermediate container 6d93c78f7a47
 ---> c11779133426
Successfully built c11779133426
Successfully tagged os:latest

You can retrieve the package owner of getopt using zypper search -f <file> :

15b83d17ed60:/ # command -v getopt
/usr/bin/getopt
15b83d17ed60:/ # command -v getopt | xargs zypper search -f 
Loading repository data...
Reading installed packages...

S | Name               | Summary                                | Type
--+--------------------+----------------------------------------+--------
  | busybox-util-linux | Busybox applets replacing util-linux   | package
i | util-linux         | A collection of basic system utilities | package

So here, installing util-linux should be enough....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM