Executing Dockerfile

I was under an impression that you can create Dockerfile only with the name “Dockerfile” but you can use -f option to give a different file name.

docker build -f jenkins-master.dockerfile -t jenkins-master:2.138.1 .

This will generate jenkins-master:2.138.1 image locally based on the Dockerfile “jenkins-master.dockerfile”. Content of the Dockerfile is shown below.

FROM jenkins/jenkins:lts
USER root
RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*

Leave a Reply

Your email address will not be published.