docker - Docker alpine:edge 如何启用测试
问题描述
我想从我的 Dockerfile 中的测试存储库安装bazel。
FROM alpine:edge AS env
RUN apk add --no-cache git build-base bazel
CMD [ "/bin/sh" ]
观察到的:
$ docker build --target env -t test .
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM alpine:edge AS env
---> 24cae4d038c0
Step 2/3 : RUN apk add --no-cache git build-base bazel
---> Running in 6ce08db21af0
fetch http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
bazel (missing):
required by: world[bazel]
The command '/bin/sh -c apk add --no-cache git build-base bazel' returned a non-zero code: 1
解决方案
只需使用:
# Create a virtual environment with all tools installed
# ref: https://hub.docker.com/_/alpine
FROM alpine:edge AS env
RUN apk add --no-cache git build-base
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing bazel
CMD [ "/bin/sh" ]
推荐阅读
- javascript - 从字符串 mssql sequelize 转换日期和/或时间时转换失败
- python - 小部件未显示在 ipywidgets 中
- error-handling - 如何返回带有一般错误的结果
- html - 向子 div 添加一个边距顶部
- jquery - 无法在 DataTable 中显示引导模式
- abap - 创建新的或添加到标准复合增强点:优点和缺点?
- laravel - 如何在不使用刀片的情况下在 Laravel 中将当前导航栏链接设置为 Active-Color
- javascript - 检测 WebView URL React Native
- flutter - 使用异步功能将数据传递到主屏幕?
- python - Bin 一个连续变量而不会使 C901 flake8 过于复杂