minor spec updates (#23213)

This commit is contained in:
Allie Sadler 2025-08-08 08:17:09 +01:00 committed by GitHub
parent 9adf210d79
commit 078cf597c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 53 additions and 37 deletions

View File

@ -175,27 +175,6 @@ args:
- GIT_COMMIT
```
### `context`
`context` defines either a path to a directory containing a Dockerfile, or a URL to a Git repository.
When the value supplied is a relative path, it is interpreted as relative to the project directory.
Compose warns you about the absolute path used to define the build context as those prevent the Compose file
from being portable.
```yml
build:
context: ./dir
```
```yml
services:
webapp:
build: https://github.com/mycompany/webapp.git
```
If not set explicitly, `context` defaults to project directory (`.`).
### `cache_from`
`cache_from` defines a list of sources the image builder should use for cache resolution.
@ -234,6 +213,27 @@ Cache target is defined using the same `type=TYPE[,KEY=VALUE]` syntax defined by
Unsupported caches are ignored and don't prevent you from building images.
### `context`
`context` defines either a path to a directory containing a Dockerfile, or a URL to a Git repository.
When the value supplied is a relative path, it is interpreted as relative to the project directory.
Compose warns you about the absolute path used to define the build context as those prevent the Compose file
from being portable.
```yml
build:
context: ./dir
```
```yml
services:
webapp:
build: https://github.com/mycompany/webapp.git
```
If not set explicitly, `context` defaults to project directory (`.`).
### `dockerfile`
`dockerfile` sets an alternate Dockerfile. A relative path is resolved from the build context.

View File

@ -1,5 +1,6 @@
---
title: Configs top-level elements
linkTitle: Configs
title: Configs top-level element
description: Manage and share configuration data using the configs element in Docker Compose.
keywords: compose, compose specification, configs, compose file reference
aliases:

View File

@ -99,6 +99,19 @@ For options, see the [Docker Engine docs](https://docs.docker.com/engine/network
## Attributes
### `attachable`
If `attachable` is set to `true`, then standalone containers should be able to attach to this network, in addition to services.
If a standalone container attaches to the network, it can communicate with services and other standalone containers
that are also attached to the network.
```yml
networks:
mynet1:
driver: overlay
attachable: true
```
### `driver`
`driver` specifies which driver should be used for this network. Compose returns an error if the
@ -127,19 +140,6 @@ networks:
Consult the [network drivers documentation](/manuals/engine/network/_index.md) for more information.
### `attachable`
If `attachable` is set to `true`, then standalone containers should be able to attach to this network, in addition to services.
If a standalone container attaches to the network, it can communicate with services and other standalone containers
that are also attached to the network.
```yml
networks:
mynet1:
driver: overlay
attachable: true
```
### `enable_ipv4`
{{< summary-bar feature_name="Compose enable ipv4" >}}

View File

@ -1438,7 +1438,7 @@ networks:
admin: {}
```
### `interface_name`
#### `interface_name`
{{< summary-bar feature_name="Compose interface-name" >}}
@ -1514,6 +1514,21 @@ networks:
`mac_address` sets the Mac address used by the service container when connecting to this particular network.
#### `driver_opts`
`driver_opts` specifies a list of options as key-value pairs to pass to the driver. These options are
driver-dependent. Consult the driver's documentation for more information.
```yml
services:
app:
networks:
app_net:
driver_opts:
foo: "bar"
baz: 1
```
#### `gw_priority`
{{< summary-bar feature_name="Compose gw priority" >}}

View File

@ -98,7 +98,7 @@ Compose gw priority:
Compose include:
requires: Docker Compose [2.20.3](/manuals/compose/releases/release-notes.md#2203) and later
Compose interface-name:
requires: Docker Compose [2.36.0](/manuals/compose/releases/release-notes.md#2203) and later
requires: Docker Compose [2.36.0](/manuals/compose/releases/release-notes.md#2360) and later
Compose label file:
requires: Docker Compose [2.32.2](/manuals/compose/releases/release-notes.md#2232) and later
Compose lifecycle hooks: