ARG substitution in RUN command not working for Dockerfile

Another thing to be careful about is that after every FROM statements all the ARGs get collected and are no longer available. Be careful with multi-stage builds.

You can reuse ARG with omitted default value inside FROM to get through this problem:

ARG VERSION=latest
FROM busybox:$VERSION
ARG VERSION
RUN echo $VERSION > image_version

Example taken from docs:
https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)