What does "copy . ." mean?

What does “copy . .” mean? Thank you.

1 Like

The COPY instruction copies new files or directories from <src> and adds them to the filesystem of the container at the path <dest>

Also

The <dest> is an absolute path, or a path relative to WORKDIR

@terpz “COPY . .” Please explain me!
What is happening in Line 11? Aren’t SRC and DEST the same?
Capture|690x327

Hi @jayjani008

It means the same thing yes, the dot is “where i am now”
So it will copy everything from the same place as the dockerfile, to “where i am now” in the container.

The “where i am now” in the image/container is defined by https://docs.docker.com/engine/reference/builder/#workdir

So if you set:
WORKDIR /tmp
and do
COPY . .

It will copy everything in the current folder, to /tmp

Hope that makes sense :slight_smile:

5 Likes

what does .e mean in COPY --from=builder /out/ .e

the complete docker file is below…

FROM mcr.microsoft.com/dotnet/core/sdk:3.0.100-preview9 AS builder

WORKDIR /src
COPY src/DotNetConf2019.csproj .
RUN dotnet restore

COPY src/ .
RUN dotnet publish -c Release -o /out DotNetConf2019.csproj

app image

FROM mcr.microsoft.com/dotnet/core/runtime:3.0.0-preview9

WORKDIR /app
ENTRYPOINT ["/bin/sh"]
ENV DotNetBot:Message=“docker4theEdge!”

COPY --from=builder /out/ .e

@sasidhar6696, im not sure why you would do it, but in that way a folder in WORKDIR (/app) will be created, named “.e”, fullpath: /app/.e

@terpz
Thanks for the reply . I am new to docker, This is one of the practice examples at https://github.com/dockersamples/dotnetconf19
I am pretty much sure its not creating a directory .e under /app, when I logged into container’s terminal, there isn’t “/app/.e”!!

How do you check?
remember its a dot file (hidden) so either cd /app/.e or ls -la /app

else I have no idea

Hello. Do you speak English?

Dopy command: COPY src dest copies files from a local source location to the destination in the Docker container. So COPY. . command copies everything from the root directory of the Dockerfile to the container.