variable
variable

Reputation: 9724

Is `.` destination for the ADD/COPY dockerfile commands resolved with respect to WORKDIR?

Dockerfile ADD/COPY commands support the destination value to be a relative (to WORKDIR) path or an absolute path. Also, the source value is always the build context.

However, if the destination is specified as ., then is it resolved with respect to the WORKDIR (and does it default to the root (C:) if WORKDIR is not specified)?

Upvotes: 1

Views: 771

Answers (2)

Mehant Kammakomati
Mehant Kammakomati

Reputation: 880

WORKDIR app

this statement creates a folder named app and moves to that directory which is app

COPY <host> <container>
  • host: relative location where the docker file exists.
  • container: location in the container which will be relative to where you are presently in the container. You initially start in the root directory of the container but when you use RUN cd or WORKDIR on dockerfile then the location would be relative to where you are presently in the container.

Upvotes: 1

nischay goyal
nischay goyal

Reputation: 3480

Yes, your understanding is correct. . will consider the current directory as WORKDIR(if it's specified) and if not, then by default it will consider to / or root directory as .

Upvotes: 2

Related Questions