Sobes.tech
Junior — Middle

What is the main purpose of using the COPY command in Dockerfile?

sobes.tech AI

Answer from AI

The COPY command in a Dockerfile is used to copy files and directories from the build context (local filesystem) into the Docker image. This allows including necessary source files, configurations, or scripts into the image.

Example usage:

COPY ./app /usr/src/app

Here, the contents of the local folder app will be copied into the /usr/src/app directory inside the container.