November 2018
Beginner
230 pages
6h 4m
English
Again, here is a pair of instructions that have a similar functionality. They both can be used during the build of an image, setting parameters to be available to use within other Dockerfile instructions. The other Dockerfile instructions that can use these parameters are FROM, LABEL, COPY, ADD, ENV, USER, WORKDIR, RUN, VOLUME, EXPOSE, STOPSIGNAL, and ONBUILD. Here is an example of using the ARG and ENV variables in other Docker commands:
# ENV vs ARG instruction Dockerfile for Docker Quick StartFROM alpineLABEL maintainer="Earl Waud <earlwaud@mycompany.com>"ENV lifecycle="production"RUN echo ${lifecycle}ARG username="35"RUN echo ${username}ARG appdirRUN echo ${appdir}ADD hello /${appdir}/RUN chown -R ${username}:${username} ...Read now
Unlock full access