尝试使用我创建的另一个自定义映像(Y)构建docker映像(X)。在这里,我正尝试将文件夹从基本图像Y复制到X,如下所示。
FROM some-image as base
COPY --from=base /root/.m2 /root
RUN mkdir -p /build
但这会引发错误invalid from flag value base: pull access denied for base, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
我该如何实现?
答案 0 :(得分:2)
您不是要处理一些基本图像,而是要在同一图像中进行复制。
您需要第二步才能使用COPY-从您无法指向 -从当前更改到相同的阶段。
这是最简单的例子,
override fun setPrimaryItem(container: ViewGroup, position: Int, object: Any) {
super.setPrimaryItem(container, position, object)
var mCurrentView = DataBindingUtil.getBinding<DcMediaPagerItemBinding>(object as View)}
hello.c
FROM alpine as build-env
RUN apk add --no-cache build-base
WORKDIR /app
COPY . .
# Compile the binaries
RUN gcc -o hello helloworld.c
FROM alpine
COPY --from=build-env /app/hello /app/hello
WORKDIR /app
CMD ["/app/hello"]