Skip to content

Instantly share code, notes, and snippets.

@singh1469
Forked from leanderjanssen/docker-labels.md
Created April 12, 2017 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save singh1469/b9c59517f8bc354f955ee4d064d31fe5 to your computer and use it in GitHub Desktop.
Save singh1469/b9c59517f8bc354f955ee4d064d31fe5 to your computer and use it in GitHub Desktop.
Example of a Dockerfile with LABEL and ARG

Example of using LABEL and ARG in a Dockerfile

Dockerfile

FROM ubuntu:14.04
RUN apt-get -y update
RUN apt-get -y install vim
RUN apt-get -y install curl
ARG GIT_COMMIT=unknown
LABEL git-commit=$GIT_COMMIT

Building the image

docker build -t test --build-arg GIT_COMMIT=0123456789 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment