Skip to content

Instantly share code, notes, and snippets.

@mrsimonemms
Forked from leanderjanssen/docker-labels.md
Created April 12, 2017 08:36
Show Gist options
  • Save mrsimonemms/b6d45d2b73bcd60abb10319d6398cbdc to your computer and use it in GitHub Desktop.
Save mrsimonemms/b6d45d2b73bcd60abb10319d6398cbdc 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