Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the purpose of COPY --from=gloursdocker/docker / /? #401

Open
lucassus opened this issue Nov 6, 2023 · 5 comments
Open

What is the purpose of COPY --from=gloursdocker/docker / /? #401

lucassus opened this issue Nov 6, 2023 · 5 comments

Comments

@lucassus
Copy link

lucassus commented Nov 6, 2023

This instruction, for some reason, is used in many examples.
The comment install Docker tools (cli, buildx, compose) in my opinion, is not really helpful.

@zozitak
Copy link

zozitak commented Nov 15, 2023

@lucassus
Copy link
Author

@zozitak thank you. I saw it, but still it's pretty hard to figure out what it exactly does.

@arjuuuuunnnnn
Copy link

Copying all the contents of the root directory (/) from the gloursdocker/docker image into the root directory (/) of the current build stage

@ehhc
Copy link

ehhc commented Apr 30, 2024

Copying all the contents of the root directory (/) from the gloursdocker/docker image into the root directory (/) of the current build stage

Thanks for your answer. I believe, most of us here understand, what that command literally does. I hopped for a bit more explanation on why the root directory was copied and some elaboration about the effects of this copying…

@arjuuuuunnnnn
Copy link

Copying all the contents of the root directory (/) from the gloursdocker/docker image into the root directory (/) of the current build stage

Thanks for your answer. I believe, most of us here understand, what that command literally does. I hopped for a bit more explanation on why the root directory was copied and some elaboration about the effects of this copying…

When you build a Docker image, each instruction in the Dockerfile creates a new layer on top of the previous one

gloursdocker/docker this is the official docker image which has all the base files required for the application

so here we are copying the entire contents of the gloursdocker/docker to our docker image
as there is already an image of gloursdocker/docker which is official image of docker

we need not build the same image again and used the cached one from gloursdocker/docker
also coming to the question 'why the root directory was copied'

  • to include the entire contents of that base image as the foundation for the new Docker image being built

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants