Skip to content

Clarify documentation of path argument when building an image #3043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docker/api/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ def build(self, path=None, tag=None, quiet=False, fileobj=None,
'{"stream":"Successfully built 032b8b2855fc\\n"}']

Args:
path (str): Path to the directory containing the Dockerfile
path (str): Path to the directory containing the Dockerfile.
Typically, the Dockerfile is a direct child of `path`,
but it can also be in a nested directory.
A copy of the `path` directory, excluding files specified
in `.dockerignore`, will be used as the build context.
Comment on lines +62 to +66
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
path (str): Path to the directory containing the Dockerfile.
Typically, the Dockerfile is a direct child of `path`,
but it can also be in a nested directory.
A copy of the `path` directory, excluding files specified
in `.dockerignore`, will be used as the build context.
path (str): Build context (either path to directory or Git URL).
By default, the Dockerfile in the context root will be used.
Alternatively, specify either the dockerfile or fileobj
arguments.

fileobj: A file object to use as the Dockerfile. (Or a file-like
object)
tag (str): A tag to add to the final image
Expand Down
6 changes: 5 additions & 1 deletion docker/models/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ def build(self, **kwargs):
low-level API.

Args:
path (str): Path to the directory containing the Dockerfile
path (str): Path to the directory containing the Dockerfile.
Typically, the Dockerfile is a direct child of `path`,
but it can also be in a nested directory.
A copy of the `path` directory, excluding files specified
in `.dockerignore`, will be used as the build context.
Comment on lines +237 to +241
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
path (str): Path to the directory containing the Dockerfile.
Typically, the Dockerfile is a direct child of `path`,
but it can also be in a nested directory.
A copy of the `path` directory, excluding files specified
in `.dockerignore`, will be used as the build context.
path (str): Build context (either path to directory or Git URL).
By default, the Dockerfile in the context root will be used.
Alternatively, specify either the dockerfile or fileobj
arguments.

fileobj: A file object to use as the Dockerfile. (Or a file-like
object)
tag (str): A tag to add to the final image
Expand Down