-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
area/buildRelates to Dockerfiles or docker build commandRelates to Dockerfiles or docker build commandlifecycle/lockedstatus/triageNeeds triageNeeds triage
Description
Is this a docs issue?
- My issue is about the documentation content or website
Type of issue
Information is incorrect
Description
The documentation for COPY states:
- The path must be inside the build context; you can't use COPY ../something /something, because the builder can only access files from the context, and ../something specifies a parent file or directory of the build context root.
Let's say my Dockerfile is not in the project root directory but nested inside some directory, e.g.:
bin/
file.go
docker/
DockerfileNow I run docker build -f docker/Dockerfile -t my-tag . from the project root so the . means the build context root is the project root.
The following Dockerfile works:
FROM alpine
COPY bin/file.go /bin/file.goHowever this Dockerfile also works (notice ../ in the path for file.go):
FROM alpine
COPY ../bin/file.go /bin/file.goI would expect this to fail as the build context is a project root and using ../ we go to the parent directory which is outside of the build context.
Location
https://docs.docker.com/reference/dockerfile/
Suggestion
No response
Metadata
Metadata
Assignees
Labels
area/buildRelates to Dockerfiles or docker build commandRelates to Dockerfiles or docker build commandlifecycle/lockedstatus/triageNeeds triageNeeds triage