Install git in docker

The same Dockerfile used to work fine last year, but I cannot install git in fresh opensuse/tumbleweed image:

docker run --rm opensuse/tumbleweed zypper -n install --no-recommends git-core
...
(37/39) Installing: openssh-server-8.4p1-4.1.x86_64 ...................................................................................................................................................................................................................................[error]Installation of openssh-server-8.4p1-4.1.x86_64 failed:
Error: Subprocess failed. Error: RPM failed: find: '/etc/init.d/rc[35].d': No such file or directory
ERROR: neither useradd nor busybox found!
error: %prein(openssh-server-8.4p1-4.1.x86_64) scriptlet failed, exit status 1
error: openssh-server-8.4p1-4.1.x86_64: install failed

Installing shadow or busybox packages not helping. Interactively I can ignore the error in openssh-server (which is not needed anyway) and have git installed after that. But I need to do it in Dockerfile, any way to do it?

This seems to be introduced last month: https://build.opensuse.org/request/show/866401.

Options:

  1. Ask git-core maintainers to remove dependency on openssh-server
  2. Report issue to openssh-server maintainers
  3. Take the openssh-server.rpm file and install with “rpm --noscripts”, then proceed with “zypper in git-core”
  4. All of the above

works4me


$ docker run --rm opensuse/tumbleweed zypper -n install --no-recommends git-core 
Unable to find image 'opensuse/tumbleweed:latest' locally 
latest: Pulling from opensuse/tumbleweed 
1410d01a0cee: Pull complete 
...
(36/39) Installing: sysuser-shadow-3.0-9.1.noarch ....done] 
(37/39) Installing: openssh-server-8.4p1-4.1.x86_64 ...........done] 
Additional rpm output: 
find: '/etc/init.d/rc[35].d': No such file or directory 
/usr/sbin/useradd -r -s /sbin/nologin -c SSH daemon -d /var/lib/sshd -U sshd 
Updating /etc/sysconfig/ssh ... 


(38/39) Installing: openssh-8.4p1-4.1.x86_64 ...done] 
Additional rpm output: 
find: '/etc/init.d/rc[35].d': No such file or directory 


(39/39) Installing: git-core-2.30.0-1.2.x86_64 ............done] 
Executing %posttrans script 'pam-1.5.1-2.2.x86_64.rpm' ......done]

As suggested on reddit

docker run --rm --security-opt seccomp:unconfined opensuse/tumbleweed zypper -n install --no-recommends git-core

is working for me.
I’m using custom python docker client with templates for building dockerfiles, so need to figure out how to set that option there, but that’s a separate story.

That’s a new one. Is your host openSUSE as well? And which docker version are you running?

tried on proxmox (debian busted based), ubuntu 20.04 and ubuntu 20.04 in wsl 2. docker 20.10.2 and 20.10.3

In the light of this information, it is not really an openSUSE/TW issue, more due to the way that openssh-server is being packaged now in TW and the way docker is packaged on Debian/Ubuntu.