Skip to content
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

add more buildkit docs #1493

Merged
merged 1 commit into from
Nov 21, 2018
Merged

Conversation

tonistiigi
Copy link
Member

@tonistiigi tonistiigi commented Nov 1, 2018

@tiborvass @AkihiroSuda @andrewhsu @thaJeztah

wip: the links to buildkit repo need moby/buildkit#710 merged

Feel free to carry or change directly on lot of changes.

Signed-off-by: Tonis Tiigi tonistiigi@gmail.com

@codecov-io
Copy link

codecov-io commented Nov 1, 2018

Codecov Report

Merging #1493 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1493   +/-   ##
=======================================
  Coverage   55.23%   55.23%           
=======================================
  Files         289      289           
  Lines       19374    19374           
=======================================
  Hits        10702    10702           
  Misses       7977     7977           
  Partials      695      695

@@ -226,8 +248,61 @@ following lines are all treated identically:

The following parser directive is supported:
Copy link
Contributor

Choose a reason for hiding this comment

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

The following parser directives are supported:

@andrewhsu
Copy link
Contributor

cc @ahh-docker

Copy link
Contributor

@andrewhsu andrewhsu left a comment

Choose a reason for hiding this comment

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

LGTM


## BuildKit

Starting from version 18.09, Docker supports a new backend for executing your
Copy link
Collaborator

Choose a reason for hiding this comment

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

s/18.09/18.06/ ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it is too complicated to explain the need to enable experimental for 18.06. If you want to just use BuildKit the recommendation is to upgrade to at least 18.09.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

Overall looks god; left some comments inline

also ping @ahh-docker PTAL

## BuildKit

Starting from version 18.09, Docker supports a new backend for executing your
builds that is provided by [moby/buildkit](https://github.com/moby/buildkit)
Copy link
Member

Choose a reason for hiding this comment

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

provided by -> provided by the

* Incrementally transfer only the changed files in your build context between builds
* Detect and skip transferring unused files in your build context
* Use external Dockerfile implementations with many new features
* Avoid leaking dangling images and containers to the rest of the API
Copy link
Member

Choose a reason for hiding this comment

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

"leaking dangling images" makes it sound like it's a bug, but it's a limitation of the old builder. Perhaps something like; "Use a dedicated, configurable build cache, omitting the use of intermediate images as a caching mechanism".

* Detect and skip transferring unused files in your build context
* Use external Dockerfile implementations with many new features
* Avoid leaking dangling images and containers to the rest of the API
* Prioritize your build cache for automatic pruning
Copy link
Member

Choose a reason for hiding this comment

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

Not sure I understand the "Prioritize". Is this the configurable garbage collection?

Copy link
Member Author

Choose a reason for hiding this comment

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

That is gc and prune --keep-storage that removes unused based on priority.

* Avoid leaking dangling images and containers to the rest of the API
* Prioritize your build cache for automatic pruning

To use the BuildKit backend in 18.09, you need to set an environment variable
Copy link
Member

Choose a reason for hiding this comment

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

I'd remove the in 18.09 here; we generally try to avoid calling out which version something was introduced in (as the reference documentation is already versioned), and we already mention this in the introduction.

* Prioritize your build cache for automatic pruning

To use the BuildKit backend in 18.09, you need to set an environment variable
`DOCKER_BUILDKIT=1` on the CLI before invoking `docker build`.
Copy link
Member

Choose a reason for hiding this comment

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

I think this is now also configurable in the CLI configuration file? (if so, we should have a link to that configuration somewhere). Could be in a new section "configure the Docker CLI to use the BuildKit builder" (e.g.)

Wondering which one we consider the "preferred" mechanism, and/or if we should call out (dis)advantages of both ways to configure.

(I'm ok with addressing that in a follow-up)

Copy link
Member Author

Choose a reason for hiding this comment

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

Some of it was covered by #1314

external implementations of builders that are distributed as Docker images and
execute inside a container sandbox environment.

Using a custom Dockerfile implementation allows you to:
Copy link
Member

Choose a reason for hiding this comment

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

"Using a" could be removed here;

Custom Dockerfile implementations allow you to:

Also, could you add a blank line between this line and the bullet-list?


Here is the complete list of the different build `ARG` variables:

* TARGETPLATFORM - platform of the build result. Eg `linux/amd64`, `linux/arm/v7`, `windows/amd64`.
Copy link
Member

Choose a reason for hiding this comment

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

Can you put the arg's in backticks? TARGETPLATFORM, TARGETOS (and so on)

resulting image (target platform). The target platform can be specified with
the `--platform` flag on `docker build`.

Here is the complete list of the different build `ARG` variables:
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps; "The following ARG variables are set automatically:"


For example:

```
Copy link
Member

Choose a reason for hiding this comment

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

Can you add Dockerfile code hint?

```Dockerfile

@@ -1931,6 +2038,14 @@ required such as `zsh`, `csh`, `tcsh` and others.

The `SHELL` feature was added in Docker 1.12.

## Experimental features
Copy link
Member

Choose a reason for hiding this comment

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

Probably needs a mention in the experimental docs; https://github.com/docker/cli/blob/master/experimental/README.md (ok for a follow-up)

Copy link
Member Author

Choose a reason for hiding this comment

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

This is not the same experimental. Changed to external to avoid confusion.

@ahh-docker
Copy link
Contributor

@tonistiigi please add me as a reviewer. Thanks!

@tonistiigi
Copy link
Member Author

@thaJeztah updated

@tonistiigi
Copy link
Member Author

@thaJeztah ping. can we merge this as 18.09 is out.

Copy link
Collaborator

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

LGTM 🐯

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

squashed the commits, and fixed one typo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants