Sobes.tech
Junior — Middle

Which command is used to copy the contents of a directory with files into a Docker image?

sobes.tech AI

Answer from AI

The COPY command in a Dockerfile is used to copy the contents of a directory with files into a Docker image.

Example:

COPY ./local_directory /app/directory_in_container

Here, ./local_directory is the path to the directory on the host machine, and /app/directory_in_container is the path inside the container where the contents will be copied.

The COPY command copies all files and subfolders from the specified local directory into the image.