From a1de49d92a68bdb3568d94dc7b791ff18854e7dd Mon Sep 17 00:00:00 2001 From: unclejack Date: Wed, 28 May 2014 20:53:16 +0300 Subject: [PATCH] add support for COPY to docker build This adds a COPY command to docker build which works like ADD, but is only for local files and it doesn't extract files. Docker-DCO-1.1-Signed-off-by: Cristian Staretu (github: unclejack) Upstream-commit: 5f1114d9550df4d54d31e9340bef07b2f315fcc6 Component: cli --- .../cli/docs/sources/reference/builder.md | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/components/cli/docs/sources/reference/builder.md b/components/cli/docs/sources/reference/builder.md index 6a4ae4ad25..235d92e1b7 100644 --- a/components/cli/docs/sources/reference/builder.md +++ b/components/cli/docs/sources/reference/builder.md @@ -290,6 +290,46 @@ The copy obeys the following rules: - If `` doesn't exist, it is created along with all missing directories in its path. +## COPY + + COPY + +The `COPY` instruction will copy new files from `` and add them to the +container's filesystem at path ``. + +`` must be the path to a file or directory relative to the source directory +being built (also called the *context* of the build). + +`` is the absolute path to which the source will be copied inside the +destination container. + +All new files and directories are created with a uid and gid of 0. + +> **Note**: +> If you build using STDIN (`docker build - < somefile`), there is no +> build context, so `COPY` can't be used. + +The copy obeys the following rules: + +- The `` path must be inside the *context* of the build; + you cannot `COPY ../something /something`, because the first step of a + `docker build` is to send the context directory (and subdirectories) to the + docker daemon. + +- If `` is a directory, the entire directory is copied, including + filesystem metadata. + +- If `` is any other kind of file, it is copied individually along with + its metadata. In this case, if `` ends with a trailing slash `/`, it + will be considered a directory and the contents of `` will be written + at `/base()`. + +- If `` does not end with a trailing slash, it will be considered a + regular file and the contents of `` will be written at ``. + +- If `` doesn't exist, it is created along with all missing directories + in its path. + ## ENTRYPOINT ENTRYPOINT has two forms: