docker - Docker镜像-apt get update -y错误

标签 docker

构建图像时出现以下错误

Sending build context to Docker daemon  8.724MB
Step 1/2 : FROM bde2020/spark-worker:2.4.5-hadoop2.7
 ---> ddb1ab6d9850
Step 2/2 : RUN apt-get update -y
 ---> Running in 99bbfdabe226
/bin/sh: apt-get: not found
The command '/bin/sh -c apt-get update -y' returned a non-zero code: 127 
这是 docker 文件
FROM bde2020/spark-worker:2.4.5-hadoop2.7
RUN apt-get update -y

最佳答案

该镜像的基本操作系统是Alpine linux。您可以验证自己:

$ docker run --rm -it --entrypoint=cat bde2020/spark-worker:2.4.5-hadoop2.7 /etc/*-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.10.4
PRETTY_NAME="Alpine Linux v3.10"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
cat: can't open '/etc/system-release': No such file or directory
因此,您想使用apt而不是apk

关于docker - Docker镜像-apt get update -y错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63656550/

相关文章:

linux - 为 Docker 实例化复制文件时出错

python - 如何使用Heroku在状态下部署Dash应用程序?

spring-boot - 如何安装和运行 wkhtmltopdf Docker 镜像

multithreading - Docker 容器而不是多处理

docker - Kubernetes/Rancher中的Docker网络

Docker 中的 Apache 说 : Symbolic link not allowed

docker - 无法在Docker容器中运行FreeBSD终端

nginx - Kubernetes Minikube Secrets 似乎未安装在 Pod 中

node.js - 通过express运行webpack-dev服务器

scala - 使用sbt-native-packager获得sbt项目的docker支持时出错