What is the COPY instruction in Docker good for?
Experience Level: Senior
Tags: Docker
Answer
The COPY instruction copies new files or directories from <src> (build context) and adds them to the filesystem of the container at the path <dest>.
Example:
COPY file* /dest/
If the <dest> is a relative folder, it is relative to the current folder that is defined by WORKDIR instruction.
Related Docker job interview questions
What is the USER instruction good for in Docker?
Docker SeniorHow do you copy files to your Docker image during built while configuring permissions as well?
Docker SeniorHow can you view the values on the environment variables that were set using the ENV instruction in a Dockerfile?
Docker SeniorWill the variables set using the ENV instruction in a Dockerfile be persisted in the built image?
Docker SeniorWhat is the ENV instruction good for in Docker?
Docker Senior