March 2020
Beginner
592 pages
14h 14m
English
The COPY and ADD keywords are very important since, in the end, we want to add some content to an existing base image to make it a custom image. Most of the time, these are a few source files of—say—a web application, or a few binaries of a compiled application.
These two keywords are used to copy files and folders from the host into the image that we're building. The two keywords are very similar, with the exception that the ADD keyword also lets us copy and unpack TAR files, as well as providing a URL as a source for the files and folders to copy.
Let's look at a few examples of how these two keywords can be used, as follows:
COPY . /appCOPY ./web /app/webCOPY sample.txt /data/my-sample.txtADD sample.tar /app/bin/ ...
Read now
Unlock full access