Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy . . in dockerfile

Tags:

docker

copy

I understand that COPY can copy files from source folder to destination, but what is purpose of COPY . .?

For example:

FROM ruby:2.5.1
WORKDIR /usr/src/app
COPY Gemfile Gemfile.lock ./
RUN bundle install
COPY . .
CMD ["./your-daemon-or-script.rb"]
like image 204
Peter Dub Avatar asked Nov 30 '25 02:11

Peter Dub


2 Answers

That will copy the current working directory of your local machine into the current working directory of the container.

like image 105
OK sure Avatar answered Dec 04 '25 08:12

OK sure


See the WORKDIR

This command will copy all the content of the parent directory in which your dockerfile resides(contents of your machine) to the location of the WORKDIR in your container.

like image 45
Abhishek Kumar Avatar answered Dec 04 '25 08:12

Abhishek Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!