What does the 'COPY' command in a Dockerfile do?

QuestionsQuestions8 SkillsProCustom Docker ImagesDec, 09 2025
091

The COPY command in a Dockerfile is used to copy files or directories from the host machine (the build context) into the Docker image at a specified path. The syntax is as follows:

COPY <source> <destination>
  • <source>: The path to the file or directory on the host machine.
  • <destination>: The path inside the Docker image where the files or directories will be copied.

For example:

COPY . /app

This command copies all files from the current directory on the host into the /app directory in the Docker image.

0 Comments

no data
Be the first to share your comment!