What does "RUN apk add --no-cache tree" mean in a Dockerfile

Viewed 5458

I came across the following Dockerfile.

FROM registry

# I am not clear what this is.
# I do not understand the following comment either.
# tree is helpful to peruse filesystem storage of images
RUN apk add --no-cache tree

For apk add I got the following three so links.

  1. How can I install Docker inside an alpine container?
  2. Running "apk add" command in a docker container with arguments [closed]
  3. rhat8 equivalent of "apk add --no-cache gcc musl-dev linux-headers"

This answer from the first link says "running docker inside alpine"

Can somebody enlighten me please. Why do we want to run docker inside a docker container?

What is this apk add?

1 Answers

apk is the package manager used in alpine. The command installs the tree package in the image.

Additionally the --no-cache flag, doesn't add anything to cache, so you wouldn't need to run rm /var/cache/apk/* later (which is a good practice)

Related