Docker build passing command-line argumens
We can defined command-line parameters in the Dockerfile and then allow the user who builds the
image to pass in values on the command line of docker build
.
FROM ubuntu:22.04
ARG TEXT=foo
RUN echo "Hello" > welcome.txt
RUN echo $TEXT >> welcome.txt
docker build -t mydocker --build-arg TEXT=Bar .