Skip to content

Commit 785c459

Browse files
committed
apply freshness touch ups
1 parent 2ebb347 commit 785c459

File tree

4 files changed

+124
-143
lines changed

4 files changed

+124
-143
lines changed

content/manuals/build/_index.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,13 @@ aliases:
4747
- /develop/develop-images/build_enhancements/
4848
---
4949

50-
Docker Build is one of Docker Engine's most used features. Whenever you are
51-
creating an image you are using Docker Build. Build is a key part of your
52-
software development life cycle allowing you to package and bundle your code and
53-
ship it anywhere.
50+
Docker Build is one of Docker Engine's most used features. Every time you
51+
create an image, you use Docker Build. Build is a key part of your software
52+
development lifecycle that lets you package and bundle your code and ship it
53+
anywhere.
5454

55-
Docker Build is more than a command for building images, and it's not only about
56-
packaging your code. It's a whole ecosystem of tools and features that support
57-
not only common workflow tasks but also provides support for more complex and
55+
Docker Build is more than a command for building images. It's a complete
56+
ecosystem of tools and features that supports common workflow tasks and
5857
advanced scenarios.
5958

6059
{{< grid >}}

content/manuals/build/concepts/context.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -337,13 +337,11 @@ $ docker build http://server/context.tar.gz
337337
...
338338
```
339339

340-
The download operation will be performed on the host where the BuildKit daemon
341-
is running. Note that if you're using a remote Docker context or a remote
342-
builder, that's not necessarily the same machine as where you issue the build
343-
command. BuildKit fetches the `context.tar.gz` and uses it as the build
344-
context. Tarball contexts must be tar archives conforming to the standard `tar`
345-
Unix format and can be compressed with any one of the `xz`, `bzip2`, `gzip` or
346-
`identity` (no compression) formats.
340+
The download operation runs on the host where the BuildKit daemon is running. If you
341+
use a remote Docker context or a remote builder, that might not be the same machine
342+
where you issue the build command. BuildKit fetches the `context.tar.gz` and uses it
343+
as the build context. Tarball contexts must be tar archives in the standard `tar` Unix
344+
format and can be compressed with `xz`, `bzip2`, `gzip`, or `identity` (no compression) formats.
347345

348346
## Empty context
349347

@@ -437,14 +435,14 @@ improving build speed, especially when using a remote builder.
437435
### Filename and location
438436

439437
When you run a build command, the build client looks for a file named
440-
`.dockerignore` in the root directory of the context. If this file exists, the
441-
files and directories that match patterns in the files are removed from the
442-
build context before it's sent to the builder.
438+
`.dockerignore` in the root directory of the context. If this file exists, files
439+
and directories that match patterns in the file are removed from the build context
440+
before Docker sends them to the builder.
443441

444-
If you use multiple Dockerfiles, you can use different ignore-files for each
445-
Dockerfile. You do so using a special naming convention for the ignore-files.
446-
Place your ignore-file in the same directory as the Dockerfile, and prefix the
447-
ignore-file with the name of the Dockerfile, as shown in the following example.
442+
If you use multiple Dockerfiles, you can use different ignore files for each
443+
Dockerfile. Use a special naming convention for these ignore files. Place your
444+
ignore file in the same directory as the Dockerfile, and prefix the ignore file
445+
with the name of the Dockerfile, as shown in the following example.
448446

449447
```text
450448
.
@@ -520,14 +518,14 @@ Lines that are blank after preprocessing are ignored.
520518
> For historical reasons, the pattern `.` is ignored.
521519
522520
Beyond Go's `filepath.Match` rules, Docker also supports a special wildcard
523-
string `**` that matches any number of directories (including zero). For
524-
example, `**/*.go` excludes all files that end with `.go` found anywhere in the
521+
string `**` that matches any number of directories, including zero. For
522+
example, `**/*.go` excludes all files ending with `.go` found anywhere in the
525523
build context.
526524

527525
You can use the `.dockerignore` file to exclude the `Dockerfile` and
528-
`.dockerignore` files. These files are still sent to the builder as they're
529-
needed for running the build. But you can't copy the files into the image using
530-
`ADD`, `COPY`, or bind mounts.
526+
`.dockerignore` files. These files are still sent to the builder because they are
527+
needed for running the build. However, you can't copy these files into the image
528+
using `ADD`, `COPY`, or bind mounts.
531529

532530
#### Negating matches
533531

@@ -717,7 +715,7 @@ where you have two Dockerfiles:
717715
- `base.Dockerfile`: for building a base image
718716
- `app.Dockerfile`: for building an application image
719717

720-
The `app.Dockerfile` uses the image produced by `base.Dockerfile` as it's base
718+
The `app.Dockerfile` uses the image produced by its `base.Dockerfile` as its base
721719
image:
722720

723721
```dockerfile {title=app.Dockerfile}

content/manuals/build/concepts/dockerfile.md

Lines changed: 57 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,58 @@
11
---
22
title: Dockerfile overview
33
weight: 20
4-
description: Learn about Dockerfiles and how to use them with Docker Images to build and package your software
5-
keywords: build, buildx, buildkit, getting started, dockerfile
4+
description: Learn how to use Dockerfiles to build and package your software into Docker images.
5+
keywords: dockerfile, docker build, buildx, buildkit, container image, getting started, image layers, dockerfile instructions
66
aliases:
77
- /build/hellobuild/
88
- /build/building/packaging/
99
---
1010

1111
## Dockerfile
1212

13-
It all starts with a Dockerfile.
14-
15-
Docker builds images by reading the instructions from a Dockerfile. A
16-
Dockerfile is a text file containing instructions for building your source
17-
code. The Dockerfile instruction syntax is defined by the specification
18-
reference in the [Dockerfile reference](/reference/dockerfile.md).
13+
Docker builds images by reading instructions from a Dockerfile. A
14+
Dockerfile is a text file that contains instructions for building your source
15+
code. The Dockerfile instruction syntax is defined in the
16+
[Dockerfile reference](/reference/dockerfile.md).
1917

2018
Here are the most common types of instructions:
2119

22-
| Instruction | Description |
23-
| ------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
24-
| [`FROM <image>`](/reference/dockerfile.md#from) | Defines a base for your image. |
25-
| [`RUN <command>`](/reference/dockerfile.md#run) | Executes any commands in a new layer on top of the current image and commits the result. `RUN` also has a shell form for running commands. |
26-
| [`WORKDIR <directory>`](/reference/dockerfile.md#workdir) | Sets the working directory for any `RUN`, `CMD`, `ENTRYPOINT`, `COPY`, and `ADD` instructions that follow it in the Dockerfile. |
27-
| [`COPY <src> <dest>`](/reference/dockerfile.md#copy) | Copies new files or directories from `<src>` and adds them to the filesystem of the container at the path `<dest>`. |
28-
| [`CMD <command>`](/reference/dockerfile.md#cmd) | Lets you define the default program that is run once you start the container based on this image. Each Dockerfile only has one `CMD`, and only the last `CMD` instance is respected when multiple exist. |
20+
| Instruction | Description |
21+
|-----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
22+
| [`FROM <image>`](/reference/dockerfile.md#from) | Defines a base for your image. |
23+
| [`RUN <command>`](/reference/dockerfile.md#run) | Executes commands in a new layer on top of the current image and commits the result. `RUN` also has a shell form for running commands. |
24+
| [`WORKDIR <directory>`](/reference/dockerfile.md#workdir) | Sets the working directory for any `RUN`, `CMD`, `ENTRYPOINT`, `COPY`, and `ADD` instructions that follow it in the Dockerfile. |
25+
| [`COPY <src> <dest>`](/reference/dockerfile.md#copy) | Copies new files or directories from `<src>` and adds them to the container at the path `<dest>`. |
26+
| [`CMD <command>`](/reference/dockerfile.md#cmd) | Defines the default program that runs when you start the container. Only the last `CMD` in the Dockerfile is used if multiple exist. |
2927

30-
Dockerfiles are crucial inputs for image builds and can facilitate automated,
31-
multi-layer image builds based on your unique configurations. Dockerfiles can
32-
start simple and grow with your needs to support more complex scenarios.
28+
Dockerfiles are essential for image builds and can automate multi-layer image builds
29+
based on your configuration. Dockerfiles can start simple and grow to support more
30+
complex scenarios.
3331

3432
### Filename
3533

36-
The default filename to use for a Dockerfile is `Dockerfile`, without a file
37-
extension. Using the default name allows you to run the `docker build` command
38-
without having to specify additional command flags.
34+
The default filename for a Dockerfile is `Dockerfile`, without a file extension. Using
35+
the default name lets you run the `docker build` command without extra flags.
3936

40-
Some projects may need distinct Dockerfiles for specific purposes. A common
37+
Some projects need different Dockerfiles for specific purposes. A common
4138
convention is to name these `<something>.Dockerfile`. You can specify the
42-
Dockerfile filename using the `--file` flag for the `docker build` command.
43-
Refer to the
44-
[`docker build` CLI reference](/reference/cli/docker/buildx/build.md#file)
45-
to learn about the `--file` flag.
39+
Dockerfile filename using the `--file` flag with the `docker build` command. See the
40+
[`docker build` CLI reference](/reference/cli/docker/buildx/build.md#file) for details.
4641

4742
> [!NOTE]
48-
>
49-
> We recommend using the default (`Dockerfile`) for your project's primary
50-
> Dockerfile.
43+
> We recommend using the default (`Dockerfile`) for your project's main Dockerfile.
5144
5245
## Docker images
5346

54-
Docker images consist of layers. Each layer is the result of a build
55-
instruction in the Dockerfile. Layers are stacked sequentially, and each one is
56-
a delta representing the changes applied to the previous layer.
47+
Docker images consist of layers. Each layer results from a build instruction in the
48+
Dockerfile. Layers are stacked in order, and each one represents changes applied to
49+
the previous layer.
5750

5851
### Example
5952

60-
Here's what a typical workflow for building applications with Docker looks like.
53+
A typical workflow for building applications with Docker:
6154

62-
The following example code shows a small "Hello World" application written in
63-
Python, using the Flask framework.
55+
The following example shows a small "Hello World" application in Python using Flask.
6456

6557
```python
6658
from flask import Flask
@@ -71,15 +63,14 @@ def hello():
7163
return "Hello World!"
7264
```
7365

74-
In order to ship and deploy this application without Docker Build, you would
75-
need to make sure that:
66+
Without Docker Build, you need to:
7667

77-
- The required runtime dependencies are installed on the server
78-
- The Python code gets uploaded to the server's filesystem
79-
- The server starts your application, using the necessary parameters
68+
- Install the required runtime dependencies on the server.
69+
- Upload the Python code to the server's filesystem.
70+
- Start your application on the server with the necessary parameters.
8071

81-
The following Dockerfile creates a container image, which has all the
82-
dependencies installed and that automatically starts your application.
72+
The following Dockerfile creates a container image with all dependencies installed and
73+
automatically starts your application.
8374

8475
```dockerfile
8576
# syntax=docker/dockerfile:1
@@ -98,7 +89,7 @@ EXPOSE 8000
9889
CMD ["flask", "run", "--host", "0.0.0.0", "--port", "8000"]
9990
```
10091

101-
Here's a breakdown of what this Dockerfile does:
92+
This Dockerfile does the following:
10293

10394
- [Dockerfile syntax](#dockerfile-syntax)
10495
- [Base image](#base-image)
@@ -112,46 +103,40 @@ Here's a breakdown of what this Dockerfile does:
112103

113104
### Dockerfile syntax
114105

115-
The first line to add to a Dockerfile is a [`# syntax` parser directive](/reference/dockerfile.md#syntax).
116-
While optional, this directive instructs the Docker builder what syntax to use
117-
when parsing the Dockerfile, and allows older Docker versions with [BuildKit enabled](../buildkit/_index.md#getting-started)
118-
to use a specific [Dockerfile frontend](../buildkit/frontend.md) before
119-
starting the build. [Parser directives](/reference/dockerfile.md#parser-directives)
120-
must appear before any other comment, whitespace, or Dockerfile instruction in
121-
your Dockerfile, and should be the first line in Dockerfiles.
106+
The first line is a [`# syntax` parser directive](/reference/dockerfile.md#syntax).
107+
This optional directive tells Docker which syntax to use when parsing the Dockerfile.
108+
It lets older Docker versions with [BuildKit enabled](../buildkit/_index.md#getting-started)
109+
use a specific [Dockerfile frontend](../buildkit/frontend.md) before starting the
110+
build. [Parser directives](/reference/dockerfile.md#parser-directives) must appear
111+
before any other comment, whitespace, or instruction, and should be the first line.
122112

123113
```dockerfile
124114
# syntax=docker/dockerfile:1
125115
```
126116

127117
> [!TIP]
128-
>
129-
> We recommend using `docker/dockerfile:1`, which always points to the latest
130-
> release of the version 1 syntax. BuildKit automatically checks for updates of
131-
> the syntax before building, making sure you are using the most current version.
118+
> Use `docker/dockerfile:1` to always get the latest version 1 syntax. BuildKit
119+
> checks for updates before building, so you use the most current version.
132120
133121
### Base image
134122

135-
The line following the syntax directive defines what base image to use:
123+
The next line defines the base image:
136124

137125
```dockerfile
138126
FROM ubuntu:22.04
139127
```
140128

141129
The [`FROM` instruction](/reference/dockerfile.md#from) sets your base
142-
image to the 22.04 release of Ubuntu. All instructions that follow are executed
143-
in this base image: an Ubuntu environment. The notation `ubuntu:22.04`, follows
144-
the `name:tag` standard for naming Docker images. When you build images, you
145-
use this notation to name your images. There are many public images you can
146-
leverage in your projects, by importing them into your build steps using the
147-
Dockerfile `FROM` instruction.
130+
image to Ubuntu 22.04. All following instructions run in this Ubuntu environment. The
131+
`ubuntu:22.04` notation follows the `name:tag` standard for Docker images. You can
132+
use many public images in your projects by importing them with the `FROM` instruction.
148133

149134
[Docker Hub](https://hub.docker.com/search?image_filter=official&q=&type=image)
150-
contains a large set of official images that you can use for this purpose.
135+
offers many official images you can use.
151136

152137
### Environment setup
153138

154-
The following line executes a build command inside the base image.
139+
This line runs a build command inside the base image.
155140

156141
```dockerfile
157142
# install app dependencies
@@ -164,23 +149,17 @@ the container.
164149

165150
### Comments
166151

167-
Note the `# install app dependencies` line. This is a comment. Comments in
168-
Dockerfiles begin with the `#` symbol. As your Dockerfile evolves, comments can
169-
be instrumental to document how your Dockerfile works for any future readers
170-
and editors of the file, including your future self!
152+
The `# install app dependencies` line is a comment. Comments in Dockerfiles start
153+
with `#`. Comments help document your Dockerfile for future readers and editors.
171154

172155
> [!NOTE]
173-
>
174-
> You might've noticed that comments are denoted using the same symbol as the
175-
> [syntax directive](#dockerfile-syntax) on the first line of the file.
176-
> The symbol is only interpreted as a directive if the pattern matches a
177-
> directive and appears at the beginning of the Dockerfile. Otherwise, it's
178-
> treated as a comment.
156+
> Comments use the same symbol as the [syntax directive](#dockerfile-syntax) on the
157+
> first line. The symbol is only a directive if it matches a directive pattern and is
158+
> at the start of the Dockerfile. Otherwise, it is a comment.
179159
180160
### Installing dependencies
181161

182-
The second `RUN` instruction installs the `flask` dependency required by the
183-
Python application.
162+
The second `RUN` instruction installs the `flask` dependency for the Python app.
184163

185164
```dockerfile
186165
RUN pip install flask==3.0.*
@@ -194,7 +173,7 @@ use the command to install the flask web framework.
194173

195174
The next instruction uses the
196175
[`COPY` instruction](/reference/dockerfile.md#copy) to copy the
197-
`hello.py` file from the local build context into the root directory of our image.
176+
`hello.py` file from the local build context into the root directory of our image.
198177

199178
```dockerfile
200179
COPY hello.py /
@@ -215,9 +194,8 @@ in your Docker build using the [`ENV` instruction](/reference/dockerfile.md#env)
215194
ENV FLASK_APP=hello
216195
```
217196

218-
This sets a Linux environment variable we'll need later. Flask, the framework
219-
used in this example, uses this variable to start the application. Without this,
220-
flask wouldn't know where to find our application to be able to run it.
197+
This sets a Linux environment variable needed by Flask to start the app. Without this,
198+
Flask cannot find the app to run it.
221199

222200
### Exposed ports
223201

0 commit comments

Comments
 (0)