問題
在使用開源Dockerfile構建鏡像時,dockerfile的From之前通過ARG定義版本,指定基礎鏡像,如下:
ARG VERSION=lasted
FROM alpine:${VERSION}
執行docker build
報錯如下:
Please provide a source image with `from` prior to commit
原因
允許這種用法是在docker 17.05.0-ce (2017-05-04)
之後才引入的,查看本機版本爲17.03.2-ce
,所以報錯很正常了,可以參見
Allow using build-time args (ARG) in FROM #31352
解決方案
- 更新docker版本