Skip to content

Commit 3cd9c59

Browse files
authored
Merge pull request #21579 from docker/published-update
publish updates from main
2 parents 966dcc5 + 5f1fd94 commit 3cd9c59

File tree

18 files changed

+464
-446
lines changed

18 files changed

+464
-446
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# syntax=docker/dockerfile:1
22
# check=skip=InvalidBaseImagePlatform
33

4-
ARG ALPINE_VERSION=3.20
4+
ARG ALPINE_VERSION=3.21
55
ARG GO_VERSION=1.23
66
ARG HTMLTEST_VERSION=0.17.0
77
ARG HUGO_VERSION=0.139.0
88
ARG NODE_VERSION=22
99
ARG PAGEFIND_VERSION=1.1.1
1010

1111
# base defines the generic base stage
12-
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS base
12+
FROM golang:${GO_VERSION}-alpine AS base
1313
RUN apk add --no-cache \
1414
git \
1515
nodejs \

_vale/Docker/Acronyms.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,5 @@ exceptions:
128128
- XML
129129
- XSS
130130
- YAML
131+
- ZFS
131132
- ZIP

_vale/config/vocabularies/Docker/accept.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Mac
6666
Mail(chimp|gun)
6767
Microsoft
6868
MySQL
69+
NFSv\d
6970
Netplan
7071
Nginx
7172
Nuxeo
@@ -121,8 +122,14 @@ Zsh
121122
[Rr]untimes?
122123
[Ss]andbox(ed)?
123124
[Ss]eccomp
125+
[Ss]ubmounts?
126+
[Ss]ubpaths?
127+
[Ss]ubtrees?
124128
[Ss]wappable
129+
[Ss]wappable
130+
[Ss]warm
125131
[Ss]warm
132+
[Ss]yscalls?
126133
[Ss]ysfs
127134
[Tt]oolchains?
128135
[Vv]irtiofs
@@ -169,6 +176,7 @@ tmpfs
169176
ufw
170177
umask
171178
ungated
179+
userland
172180
untrusted
173181
vSphere
174182
vpnkit

_vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# github.com/moby/moby v27.3.1+incompatible
22
# github.com/moby/buildkit v0.18.0
3-
# github.com/docker/buildx v0.19.1
3+
# github.com/docker/buildx v0.19.2
44
# github.com/docker/cli v27.4.0-rc.2+incompatible
55
# github.com/docker/compose/v2 v2.31.0
66
# github.com/docker/scout-cli v1.15.0

content/manuals/build/building/best-practices.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ database, and an in-memory cache in a decoupled manner.
145145

146146
Limiting each container to one process is a good rule of thumb, but it's not a
147147
hard and fast rule. For example, not only can containers be
148-
[spawned with an init process](/manuals/engine/containers/run.md#specify-an-init-process),
148+
[spawned with an init process](/manuals/engine/containers/multi-service_container.md),
149149
some programs might spawn additional processes of their own accord. For
150150
instance, [Celery](https://docs.celeryproject.org/) can spawn multiple worker
151151
processes, and [Apache](https://httpd.apache.org/) can create one process per

content/manuals/build/cache/garbage-collection.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ cache when the cache size becomes too big, or when the cache age expires. The
1616
following sections describe how you can configure both the size and age
1717
parameters by defining garbage collection policies.
1818

19+
Each of the policy's parameters corresponds with a `docker buildx prune` command line
20+
argument. Details can be found in the
21+
`docker buildx prune` [documentation](/reference/cli/docker/buildx/prune.md).
22+
1923
## Configuration
2024

2125
Depending on the [driver](../builders/drivers/_index.md) used by your builder instance,

content/manuals/build/ci/github-actions/multi-platform.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ them. To load a multi-platform image, you need to enable the containerd image
5353
store option for the Docker Engine.
5454
5555
There is no way to configure the default Docker setup in the GitHub Actions
56-
runners directly, but you can use the `crazy-max/ghaction-setup-docker` action
57-
to customize the Docker Engine and CLI settings for a job.
56+
runners directly, but you can use `docker/setup-docker-action` to customize the
57+
Docker Engine and CLI settings for a job.
5858

5959
The following example workflow enables the containerd image store, builds a
6060
multi-platform image, and loads the results into the GitHub runner's local
@@ -71,7 +71,7 @@ jobs:
7171
runs-on: ubuntu-latest
7272
steps:
7373
- name: Set up Docker
74-
uses: crazy-max/ghaction-setup-docker@v3
74+
uses: docker/setup-docker-action@v4
7575
with:
7676
daemon-config: |
7777
{

content/manuals/engine/storage/_index.md

Lines changed: 47 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -9,206 +9,72 @@ aliases:
99
---
1010

1111
By default all files created inside a container are stored on a writable
12-
container layer. This means that:
12+
container layer that sits on top of the read-only, immutable image layers.
1313

14-
- The data doesn't persist when that container no longer exists, and it can be
15-
difficult to get the data out of the container if another process needs it.
16-
- A container's writable layer is tightly coupled to the host machine
17-
where the container is running. You can't easily move the data somewhere else.
18-
- Writing into a container's writable layer requires a
19-
[storage driver](/engine/storage/drivers/) to manage the
20-
filesystem. The storage driver provides a union filesystem, using the Linux
21-
kernel. This extra abstraction reduces performance as compared to using
22-
_data volumes_, which write directly to the host filesystem.
14+
Data written to the container layer doesn't persist when the container is
15+
destroyed. This means that it can be difficult to get the data out of the
16+
container if another process needs it.
2317

24-
Docker has two options for containers to store files on the host machine, so
25-
that the files are persisted even after the container stops: volumes, and
26-
bind mounts.
18+
The writable layer is unique per container. You can't easily extract the data
19+
from the writeable layer to the host, or to another container.
2720

28-
Docker also supports containers storing files in-memory on the host machine. Such files are not persisted.
29-
If you're running Docker on Linux, `tmpfs` mount is used to store files in the host's system memory.
30-
If you're running Docker on Windows, named pipe is used to store files in the host's system memory.
21+
## Storage mount options
3122

32-
## Choose the right type of mount
23+
Docker supports the following types of storage mounts for storing data outside
24+
of the writable layer of the container:
25+
26+
- [Volume mounts](#volume-mounts)
27+
- [Bind mounts](#bind-mounts)
28+
- [tmpfs mounts](#tmpfs-mounts)
29+
- [Named pipes](#named-pipes)
3330

3431
No matter which type of mount you choose to use, the data looks the same from
3532
within the container. It is exposed as either a directory or an individual file
3633
in the container's filesystem.
3734

38-
An easy way to visualize the difference among volumes, bind mounts, and `tmpfs`
39-
mounts is to think about where the data lives on the Docker host.
40-
41-
![Types of mounts and where they live on the Docker host](images/types-of-mounts.webp?w=450&h=300)
42-
43-
- Volumes are stored in a part of the host filesystem which is _managed by
44-
Docker_ (`/var/lib/docker/volumes/` on Linux). Non-Docker processes should not
45-
modify this part of the filesystem. Volumes are the best way to persist data
46-
in Docker.
47-
48-
- Bind mounts may be stored anywhere on the host system. They may even be
49-
important system files or directories. Non-Docker processes on the Docker host
50-
or a Docker container can modify them at any time.
51-
52-
- `tmpfs` mounts are stored in the host system's memory only, and are never
53-
written to the host system's filesystem.
54-
55-
Bind mounts and volumes can both be mounted into containers using the `-v` or
56-
`--volume` flag, but the syntax for each is slightly different. For `tmpfs`
57-
mounts, you can use the `--tmpfs` flag. We recommend using the `--mount` flag
58-
for both containers and services, for bind mounts, volumes, or `tmpfs` mounts,
59-
as the syntax is more clear.
60-
61-
### Volumes
62-
63-
Volumes are created and managed by Docker. You can create a volume explicitly
64-
using the `docker volume create` command, or Docker can create a volume during
65-
container or service creation.
66-
67-
When you create a volume, it's stored within a directory on the Docker
68-
host. When you mount the volume into a container, this directory is what's
69-
mounted into the container. This is similar to the way that bind mounts work,
70-
except that volumes are managed by Docker and are isolated from the core
71-
functionality of the host machine.
72-
73-
A given volume can be mounted into multiple containers simultaneously. When no
74-
running container is using a volume, the volume is still available to Docker
75-
and isn't removed automatically. You can remove unused volumes using `docker
76-
volume prune`.
77-
78-
When you mount a volume, it may be named or anonymous. Anonymous volumes are
79-
given a random name that's guaranteed to be unique within a given Docker host.
80-
Just like named volumes, anonymous volumes persist even if you remove the
81-
container that uses them, except if you use the `--rm` flag when creating the
82-
container, in which case the anonymous volume is destroyed.
83-
See [Remove anonymous volumes](volumes.md#remove-anonymous-volumes).
84-
If you create multiple containers after each other that use anonymous volumes,
85-
each container creates its own volume.
86-
Anonymous volumes aren't reused or shared between containers automatically.
87-
To share an anonymous volume between two or more containers,
88-
you must mount the anonymous volume using the random volume ID.
89-
90-
Volumes also support the use of volume drivers, which allow you to store
91-
your data on remote hosts or cloud providers, among other possibilities.
92-
93-
### Bind mounts
94-
95-
Bind mounts have limited functionality compared to volumes. When you use a bind
96-
mount, a file or directory on the host machine is mounted into a container. The
97-
file or directory is referenced by its full path on the host machine. The file
98-
or directory doesn't need to exist on the Docker host already. It is created on
99-
demand if it doesn't yet exist. Bind mounts are fast, but they rely on the host
100-
machine's filesystem having a specific directory structure available. If you
101-
are developing new Docker applications, consider using named volumes instead.
102-
You can't use Docker CLI commands to directly manage bind mounts.
103-
104-
> [!IMPORTANT]
105-
>
106-
> Bind mounts allow write access to files on the host by default.
107-
>
108-
> One side effect of using bind mounts is that you can change the host
109-
> filesystem via processes running in a container, including creating,
110-
> modifying, or deleting important system files or directories. This is a
111-
> powerful ability which can have security implications, including impacting
112-
> non-Docker processes on the host system.
113-
114-
> [!TIP]
115-
>
116-
> Working with large repositories or monorepos, or with virtual file systems that are no longer scaling with your codebase?
117-
> Check out [Synchronized file shares](/manuals/desktop/features/synchronized-file-sharing.md). It provides fast and flexible host-to-VM file sharing by enhancing bind mount performance through the use of synchronized filesystem caches.
118-
119-
### tmpfs
120-
121-
A `tmpfs` mount isn't persisted on disk, either on the Docker host or within a
122-
container. It can be used by a container during the lifetime of the container,
123-
to store non-persistent state or sensitive information. For instance,
124-
internally, Swarm services use `tmpfs` mounts to mount
125-
[secrets](/manuals/engine/swarm/secrets.md) into a service's containers.
126-
127-
### Named pipes
128-
129-
[Named pipes](https://docs.microsoft.com/en-us/windows/desktop/ipc/named-pipes)
130-
can be used for communication between the Docker host and a container. Common
131-
use case is to run a third-party tool inside of a container and connect to the
132-
Docker Engine API using a named pipe.
133-
134-
## Good use cases for volumes
135-
136-
Volumes are the preferred way to persist data in Docker containers and services.
137-
Some use cases for volumes include:
138-
139-
- Sharing data among multiple running containers. If you don't explicitly create
140-
it, a volume is created the first time it is mounted into a container. When
141-
that container stops or is removed, the volume still exists. Multiple
142-
containers can mount the same volume simultaneously, either read-write or
143-
read-only. Volumes are only removed when you explicitly remove them.
35+
### Volume mounts
14436

145-
- When the Docker host is not guaranteed to have a given directory or file
146-
structure. Volumes help you decouple the configuration of the Docker host
147-
from the container runtime.
37+
Volumes are persistent storage mechanisms managed by the Docker daemon. They
38+
retain data even after the containers using them are removed. Volume data is
39+
stored on the filesystem on the host, but in order to interact with the data in
40+
the volume, you must mount the volume to a container. Directly accessing or
41+
interacting with the volume data is unsupported, undefined behavior, and may
42+
result in the volume or its data breaking in unexpected ways.
14843

149-
- When you want to store your container's data on a remote host or a cloud
150-
provider, rather than locally.
44+
Volumes are ideal for performance-critical data processing and long-term
45+
storage needs. Since the storage location is managed on the daemon host,
46+
volumes provide the same raw file performance as accessing the host filesystem
47+
directly.
15148

152-
- When you need to back up, restore, or migrate data from one Docker
153-
host to another, volumes are a better choice. You can stop containers using
154-
the volume, then back up the volume's directory
155-
(such as `/var/lib/docker/volumes/<volume-name>`).
156-
157-
- When your application requires high-performance I/O on Docker Desktop. Volumes
158-
are stored in the Linux VM rather than the host, which means that the reads and writes
159-
have much lower latency and higher throughput.
160-
161-
- When your application requires fully native file system behavior on Docker
162-
Desktop. For example, a database engine requires precise control over disk
163-
flushing to guarantee transaction durability. Volumes are stored in the Linux
164-
VM and can make these guarantees, whereas bind mounts are remoted to macOS or
165-
Windows, where the file systems behave slightly differently.
166-
167-
## Good use cases for bind mounts
168-
169-
In general, you should use volumes where possible. Bind mounts are appropriate
170-
for the following types of use case:
171-
172-
- Sharing configuration files from the host machine to containers. This is how
173-
Docker provides DNS resolution to containers by default, by mounting
174-
`/etc/resolv.conf` from the host machine into each container.
175-
176-
- Sharing source code or build artifacts between a development environment on
177-
the Docker host and a container. For instance, you may mount a Maven `target/`
178-
directory into a container, and each time you build the Maven project on the
179-
Docker host, the container gets access to the rebuilt artifacts.
180-
181-
If you use Docker for development this way, your production Dockerfile would
182-
copy the production-ready artifacts directly into the image, rather than
183-
relying on a bind mount.
49+
### Bind mounts
18450

185-
- When the file or directory structure of the Docker host is guaranteed to be
186-
consistent with the bind mounts the containers require.
51+
Bind mounts create a direct link between a host system path and a container,
52+
allowing access to files or directories stored anywhere on the host. Since they
53+
aren't isolated by Docker, both non-Docker processes on the host and container
54+
processes can modify the mounted files simultaneously.
18755

188-
## Good use cases for tmpfs mounts
56+
Use bind mounts when you need to be able to access files from both the
57+
container and the host.
18958

190-
`tmpfs` mounts are best used for cases when you do not want the data to persist
191-
either on the host machine or within the container. This may be for security
192-
reasons or to protect the performance of the container when your application
193-
needs to write a large volume of non-persistent state data.
59+
### tmpfs mounts
19460

195-
## Tips for using bind mounts or volumes
61+
A tmpfs mount stores files directly in the host machine's memory, ensuring the
62+
data is not written to disk. This storage is ephemeral: the data is lost when
63+
the container is stopped or restarted, or when the host is rebooted. tmpfs
64+
mounts do not persist data either on the Docker host or within the container's
65+
filesystem.
19666

197-
If you use either bind mounts or volumes, keep the following in mind:
67+
These mounts are suitable for scenarios requiring temporary, in-memory storage,
68+
such as caching intermediate data, handling sensitive information like
69+
credentials, or reducing disk I/O. Use tmpfs mounts only when the data does not
70+
need to persist beyond the current container session.
19871

199-
- If you mount an **empty volume** into a directory in the container in which files
200-
or directories exist, these files or directories are propagated (copied)
201-
into the volume. Similarly, if you start a container and specify a volume which
202-
does not already exist, an empty volume is created for you.
203-
This is a good way to pre-populate data that another container needs.
72+
### Named pipes
20473

205-
- If you mount a **bind mount or non-empty volume** into a directory in the container
206-
in which some files or directories exist, these files or directories are
207-
obscured by the mount, just as if you saved files into `/mnt` on a Linux host
208-
and then mounted a USB drive into `/mnt`. The contents of `/mnt` would be
209-
obscured by the contents of the USB drive until the USB drive was unmounted.
210-
The obscured files are not removed or altered, but are not accessible while the
211-
bind mount or volume is mounted.
74+
[Named pipes](https://docs.microsoft.com/en-us/windows/desktop/ipc/named-pipes)
75+
can be used for communication between the Docker host and a container. Common
76+
use case is to run a third-party tool inside of a container and connect to the
77+
Docker Engine API using a named pipe.
21278

21379
## Next steps
21480

0 commit comments

Comments
 (0)