I am using RUN instruction within a Dockerfile
to install a rpm
RUN yum -y install samplerpm-2.3
However, I want to pass the value "2.3" as an argument. My RUN instruction should look something like:
RUN yum -y install samplerpm-$arg
where $arg=2.3
You are looking for
--build-arg
and theARG
instruction. These are new as of Docker 1.9. Check out https://docs.docker.com/engine/reference/builder/#arg. This will allow you to addARG arg
to theDockerfile
and then build withdocker build --build-arg arg=2.3 .
.