COPY

The Dockerfile instruction that copies files from the build context into the image.

In more detail

Paths are relative to the build context, and each COPY creates a new layer. Copying only what the program needs keeps images small and caches effective.

Examples

COPY app.sh .
COPY --chown=app:app app.py .
COPY --from=builder /app/dist ./dist
COPY --from=build /out/app /app
COPY --from=build /workspace/target/app.jar app.jar

Related terms

Related guides

Taught in

References

Certification courses