[英]/bin/sh: zypper: not found (Docker)
I am trying to create and image.我正在尝试创造和形象。 But when I run docker build
.但是当我运行docker build
时。 I keep getting the error:我不断收到错误:
Step 6/7 : RUN zypper update && zypper upgrade -y && zypper install -y git
---> Running in 81e84f3be4f0
/bin/sh: zypper: not found
The command '/bin/sh -c zypper update && zypper upgrade -y && zypper install -y git' returned a non-zero code: 127
First I was getting something similar with git
not being found.首先,我得到了类似于git
的东西。 So after a bit of Googling, i found out that I probably need to install git
in the docker file.所以经过一番谷歌搜索后,我发现我可能需要在 docker 文件中安装git
。
So I added something like:所以我添加了类似的东西:
FROM maven:3.8.4 AS maven
FROM eclipse-temurin:11-jdk-alpine
RUN mkdir -p $HOME/images/lib/ && cd $HOME/images/lib/
RUN zypper update && zypper upgrade -y && zypper install -y git
#RUN apt-get update && apt-get upgrade -y && apt-get install -y git
RUN git clone MY_GIT_URL
But it errors out on the second line.但是它在第二行出错了。
My Docker info is:我的 Docker 信息是:
Client:
Context: default
Debug Mode: false
Server:
Containers: 9
Running: 0
Paused: 0
Stopped: 9
Images: 8
Server Version: 20.10.17-ce
Storage Driver: btrfs
Build Version: Btrfs v4.15
Library Version: 102
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux oci runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc version: v1.1.4-0-ga916309fff0f
init version:
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.14.21-150400.24.33-default
Operating System: openSUSE Leap 15.4
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 9.714GiB
Name: localhost.localdomain
ID: U76D:CEPC:3L3J:ZTTL:C5UQ:TOEZ:DLXA:5NQQ:HOQ7:SHRC:KXBZ:HLJE
Docker Root Dir: /var/lib/docker
Debug Mode: false
Username: MY_USERNAME
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
The container image eclipse-temurin:11-jdk-alpine
is based on Alpine Linux, not Suse.容器镜像eclipse-temurin:11-jdk-alpine
基于 Alpine Linux,不是 Suse。 Thus, to install operating system packages, use apk
instead of zypper
.因此,要安装操作系统包,请使用apk
而不是zypper
。 For example:例如:
RUN apk update && apk add git
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.