DevOps-Academy-Org / dca-prep-guide

Docker Certification Associate preparation guide - a list of resources to help you prepare for a successful certification
MIT License
858 stars 375 forks source link

Update Modify_an_image_to_a_single_layer.md #12

Closed lalyos closed 6 years ago

lalyos commented 6 years ago

docker build can squash the image

Govinda-Fichtner commented 6 years ago

@lalyos How to you know this is about building new images with docker build --squash?

When looking at this topic in the topic guide I came to the conclusion that this has to be about flattening an existing image, because it says "modify an image to a single layer". For an existing image this cannot be done with docker build, right?

lalyos commented 6 years ago

the previous questions were about how build an image, describe Dockerfile options, and so on. So my assumption was that we have a Dockerfile. All automated images have a Dockerfile.

But you are right the word "modify" seem to imply there is an already existing image. Still if there is an existing image, you can overwrite (retag) with docker buid --squash. Overwriting an existing images is modifying it.

Govinda-Fichtner commented 6 years ago

Well, maybe we need to clarify the meaning of "modify an image to a single layer" with the authors of the study guide.

In the meantime we could just add both with a note about how it is not clear what is meant.

Also while docker export works with a container, docker image import creates an image. What do you think?

lalyos commented 6 years ago

I've updated the PR by having two options.