Skip to content

Commit dd9f070

Browse files
committed
move required properties above, and improve services tip
1 parent 856397b commit dd9f070

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

docs/concepts/compose.md

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,6 @@ services:
3838
## Compose Top-level Properties
3939
Here are a list of top-level properties of the [Compose specification](https://docs.docker.com/compose/compose-file/) that Defang supports when writing a `compose.yaml` file.
4040

41-
### `networks`
42-
(Optional)
43-
44-
The networks defined in your application. This is commonly added together with a [service-level `networks`](#networks-1) property.
45-
46-
```yaml
47-
networks:
48-
public:
49-
```
50-
51-
See our [Networking](/docs/concepts/networking) page for more.
52-
5341
### `services`
5442
(Required)
5543

@@ -62,9 +50,21 @@ services:
6250
```
6351

6452
:::info
65-
Defang identifies services by the [account username](./accounts.md) and the service name (as defined in the `compose.yaml` file). This means that if you have multiple Defang projects with the same service name, they will conflict with each other. See our [Services](/docs/concepts/services) page for more.
53+
Defang identifies a service based on your username, project name, and the service name you've defined under the `services` property. See our [Services](/docs/concepts/services) page for more about how Defang resolves service names.
6654
:::
6755

56+
### `networks`
57+
(Optional)
58+
59+
The networks defined in your application. This is commonly added together with a [service-level `networks`](#networks-1) property.
60+
61+
```yaml
62+
networks:
63+
public:
64+
```
65+
66+
See our [Networking](/docs/concepts/networking) page for more.
67+
6868
### `volumes`
6969
(Not yet supported)
7070

@@ -108,6 +108,31 @@ build:
108108
dockerfile: ./Dockerfile
109109
```
110110

111+
### `image`
112+
(Required, unless `build` is defined)
113+
114+
[This property](https://github.com/compose-spec/compose-spec/blob/main/05-services.md#image) describes the image from which your container should start.
115+
116+
```yaml
117+
image: nginx:latest
118+
```
119+
120+
### `ports`
121+
(Optional, but required if you want to access the service from outside the container)
122+
123+
The ports to expose. The default port mode is `ingress`.
124+
125+
```yaml
126+
ports:
127+
- mode: ingress
128+
target: 80
129+
published: 80
130+
```
131+
132+
:::info
133+
Defang ignores `published` ports in production. As such, it is common to make `target` and `published` ports the same when using Defang. However, it can be useful to include a `published` port for local development, such as Docker.
134+
:::
135+
111136
### `command`
112137
(Optional)
113138

@@ -187,15 +212,6 @@ healthcheck:
187212
retries: 3
188213
```
189214

190-
### `image`
191-
(Required, unless `build` is defined)
192-
193-
[This property](https://github.com/compose-spec/compose-spec/blob/main/05-services.md#image) describes the image from which your container should start.
194-
195-
```yaml
196-
image: nginx:latest
197-
```
198-
199215
### `networks`
200216
(Optional)
201217

@@ -216,22 +232,6 @@ networks:
216232

217233
See our [Networking](/docs/concepts/networking) page for more.
218234

219-
### `ports`
220-
(Optional, but required if you want to access the service from outside the container)
221-
222-
The ports to expose. The default port mode is `ingress`.
223-
224-
```yaml
225-
ports:
226-
- mode: ingress
227-
target: 80
228-
published: 80
229-
```
230-
231-
:::info
232-
Defang ignores `published` ports in production. As such, it is common to make `target` and `published` ports the same when using Defang. However, it can be useful to include a `published` port for local development, such as Docker.
233-
:::
234-
235235
### `restart`
236236
(Optional, but highly recommended)
237237

0 commit comments

Comments
 (0)