Skip to content
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN apt-get update && apt-get -y install git \
unzip

RUN mkdir /JavaPrograms
RUN mkdir /JavaPrograms/scripts
RUN mkdir /code
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for future, if you do just mkdir -p /JavaPrograms/scripts this will create both directories with one line. This is a good strategy to have for Dockerfiles, because each line is a separate layer. It's good practice to reduce your runs into as few layers as possible. Eg:

RUN mkdir -p /JavaPrograms/scripts && mkdir /code

would be more optimal, although not completely necessary :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Noted

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah dawg! Check this out when you have time: https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/ it's really interesting what an "image" actually is, think "sandwich layers" vs. "entire sandwich" :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try typing:

docker images

and you'll see all the (top level) images.. then try

docker images --digests

and you'll see each image id is actually a sha256 sum! But it gets even better... do

docker images --all

and you'll see that each "image" is actually a crapton of layers, and they are only assembled when the image is actually running. Each layer is actually a diff off of the previous ones, and then at runtime the top layer is the only one that is actually writable that maintains your changes. This is a fundamentally different model than singularity, which is an actual, one file deal, image.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fascinating concept of layers! Unlike VMs, I thought it was a one file deal.

WORKDIR /code
ADD . /code
Expand Down