You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: engine/context/aci-integration.md
+28-6
Original file line number
Diff line number
Diff line change
@@ -177,27 +177,51 @@ Total CPUs reclaimed: 2.01, total memory reclaimed: 2.30 GB
177
177
178
178
## Exposing ports
179
179
180
-
Single containers and Compose applications can optionally expose ports. For single containers, this is done using the `--publish` (`-p`) flag of the `docker run` command and for Compose applications, you must specify exposed ports in the Compose file service definition.
180
+
Single containers and Compose applications can optionally expose ports.
181
+
For single containers, this is done using the `--publish` (`-p`) flag of the `docker run` command : `docker run -p 80:80 nginx`.
182
+
183
+
For Compose applications, you must specify exposed ports in the Compose file service definition:
184
+
185
+
```yaml
186
+
services:
187
+
nginx:
188
+
image: nginx
189
+
ports:
190
+
- "80:80"
191
+
```
192
+
181
193
182
194
> **Note**
183
195
>
184
196
> ACI does not allow port mapping (that is, changing port number while exposing port). Therefore, the source and target ports must be the same when deploying to ACI.
185
197
>
186
-
>
187
-
> All containers in the same Compose application are deployed in the same ACI container group. Containers in the same Compose application cannot expose the same port when deployed to ACI.
198
+
> All containers in the same Compose application are deployed in the same ACI container group. Different containers in the same Compose application cannot expose the same port when deployed to ACI.
188
199
189
200
By default, when exposing ports for your application, a random public IP address is associated with the container group supporting the deployed application (single container or Compose application).
190
201
This IP address can be obtained when listing containers with `docker ps` or using `docker inspect`.
191
202
192
203
### DNS label name
193
204
194
205
In addition to exposing ports on a random IP address, you can specify a DNS label name to expose your application on an FQDN of the form: `<NAME>.region.azurecontainer.io`.
195
-
You can set this name with the `--domainname` flag when performing a `docker run`, or by using the `domainname` field in the Compose file when performing a `docker compose up`.
206
+
207
+
You can set this name with the `--domainname` flag when performing a `docker run`, or by using the `domainname` field in the Compose file when performing a `docker compose up`:
208
+
209
+
```yaml
210
+
services:
211
+
nginx:
212
+
image: nginx
213
+
domainname: "myapp"
214
+
ports:
215
+
- "80:80"
216
+
```
217
+
196
218
197
219
> **Note**
198
220
>
199
221
> The domain of a Compose application can only be set once, if you specify the
200
222
> `domainname` for several services, the value must be identical.
223
+
>
224
+
> The FQDN `<DOMAINNAME>.region.azurecontainer.io` must be available.
201
225
202
226
## Using Azure file share as volumes in ACI containers
Copy file name to clipboardExpand all lines: engine/context/ecs-integration.md
+33-5
Original file line number
Diff line number
Diff line change
@@ -149,22 +149,29 @@ services:
149
149
150
150
> **Note**
151
151
>
152
-
> If you set the Compose file version to 3.8 or later, you can use the same Compose file for local deployment using `docker-compose`. Custom extensions will be ignored in this case.
152
+
> If you set the Compose file version to 3.8 or later, you can use the same Compose file for local deployment using `docker-compose`. Custom ECS extensions will be ignored in this case.
153
153
154
154
## Service discovery
155
155
156
-
Service-to-service communication is implemented by the [Security Groups](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html){: target="_blank" rel="noopener" class="_"} rules, allowing services sharing a common Compose file “network” to communicate together. This allows individual services to run with distinct constraints (memory, cpu) and replication rules. However, it comes with a constraint that Docker images have to handle service discovery and wait for dependent services to be available.
156
+
Service-to-service communication is implemented transparently by default, so you can deploy your Compose applications with multiple interconnected services without changing the compose file between local and ECS deployment. Individual services can run with distinct constraints (memory, cpu) and replication rules.
157
157
158
158
### Service names
159
159
160
-
Services are registered by the Docker Compose CLI on [AWS Cloud Map](https://docs.aws.amazon.com/cloud-map/latest/dg/what-is-cloud-map.html){: target="_blank" rel="noopener" class="_"} during application deployment. They are declared as fully qualified domain names of the form: `<service>.<compose_project_name>.local`. Services can retrieve their dependencies using this fully qualified name, or can just use a short service name (as they do with docker-compose).
160
+
Services are registered automatically by the Docker Compose CLI on [AWS Cloud Map](https://docs.aws.amazon.com/cloud-map/latest/dg/what-is-cloud-map.html){: target="_blank" rel="noopener" class="_"} during application deployment. They are declared as fully qualified domain names of the form: `<service>.<compose_project_name>.local`.
161
+
162
+
Services can retrieve their dependencies using Compose service names (as they do when deploying locally with docker-compose), or optionally use the fully qualified names.
161
163
162
164
### Dependent service startup time and DNS resolution
163
165
164
-
Services get concurrently scheduled on ECS when a Compose file is deployed. AWS Cloud Map introduces an initial delay for DNS service to be able to resolve your services domain names. As a result, your code needs to be adjusted to support this delay by waiting for dependent services to be ready, or by adding a wait-script as the entrypoint to your Docker image, as documented in [Control startup order](https://docs.docker.com/compose/startup-order/).
166
+
Services get concurrently scheduled on ECS when a Compose file is deployed. AWS Cloud Map introduces an initial delay for DNS service to be able to resolve your services domain names. Your code needs to support this delay by waiting for dependent services to be ready, or by adding a wait-script as the entrypoint to your Docker image, as documented in [Control startup order](https://docs.docker.com/compose/startup-order/).
167
+
Note this need to wait for dependent services in your Compose application also exists when deploying locally with docker-compose, but the delay is typically shorter. Issues might become more visible when deploying to ECS if services do not wait for their dependencies to be available.
165
168
166
169
Alternatively, you can use the [depends_on](https://github.com/compose-spec/compose-spec/blob/master/spec.md#depends_on){: target="_blank" rel="noopener" class="_"} feature of the Compose file format. By doing this, dependent service will be created first, and application deployment will wait for it to be up and running before starting the creation of the dependent services.
167
170
171
+
### Service isolation
172
+
173
+
Service isolation is implemented by the [Security Groups](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html){: target="_blank" rel="noopener" class="_"} rules, allowing services sharing a common Compose file “network” to communicate together using their Compose service names.
174
+
168
175
## Volumes
169
176
170
177
ECS integration supports volume management based on Amazon Elastic File System (Amazon EFS).
@@ -279,6 +286,15 @@ value `*` to get all keys bound in your container.
279
286
280
287
## Auto scaling
281
288
289
+
Scaling service static information (non auto-scaling) can be specified using the normal Compose syntax:
290
+
291
+
```yaml
292
+
services:
293
+
foo:
294
+
deploy:
295
+
replicas: 3
296
+
```
297
+
282
298
The Compose file model does not define any attributes to declare auto-scaling conditions.
283
299
Therefore, we rely on `x-aws-autoscaling` custom extension to define the auto-scaling range, as
284
300
well as cpu _or_ memory to define target metric, expressed as resource usage percent.
@@ -336,7 +352,19 @@ The Docker Compose CLI relies on [Amazon CloudFormation](https://docs.aws.amazon
336
352
337
353
## Using existing AWS network resources
338
354
339
-
By default, the Docker Compose CLI creates an ECS cluster for your Compose application, a Security Group per network in your Compose file on your AWS account’s default VPC, and a LoadBalancer to route traffic to your services. If your AWS account does not have [permissions](https://github.com/docker/ecs-plugin/blob/master/docs/requirements.md#permissions){: target="_blank" rel="noopener" class="_"} to create such resources, or if you want to manage these yourself, you can use the following custom Compose extensions:
355
+
By default, the Docker Compose CLI creates an ECS cluster for your Compose application, a Security Group per network in your Compose file on your AWS account’s default VPC, and a LoadBalancer to route traffic to your services.
356
+
357
+
With the following basic compose file, the Docker Compose CLI will automatically create these ECS constructs including the load balancer to route traffic to the exposed port 80.
358
+
359
+
```yaml
360
+
services:
361
+
nginx:
362
+
image: nginx
363
+
ports:
364
+
- "80:80"
365
+
```
366
+
367
+
If your AWS account does not have [permissions](https://github.com/docker/ecs-plugin/blob/master/docs/requirements.md#permissions){: target="_blank" rel="noopener" class="_"} to create such resources, or if you want to manage these yourself, you can use the following custom Compose extensions:
340
368
341
369
- Use `x-aws-cluster` as a top-level element in your Compose file to set the ARN
342
370
of an ECS cluster when deploying a Compose application. Otherwise, a
0 commit comments