Menu
Amazon EC2 Container Service
Developer Guide (API Version 2014-11-13)

Windows Task Definitions

Windows containers and container instances cannot support all the task definition parameters that are available for Linux containers and container instances. For some parameters, they are not supported at all, and others behave differently on Windows than they do on Linux.

Windows Task Definition Parameters

The following matrix explains which parameters are supported, not supported, or behave differently on Windows containers. For more information about these parameters as they relate to Amazon ECS, see Task Definition Parameters.

family

Supported: Yes

taskRoleArn

Supported: Yes

Additional notes: IAM roles for tasks on Windows require that you set the ECS_ENABLE_TASK_IAM_ROLE environment variable to true when you launch your container instances. Your containers must also run some configuration code in order to take advantage of the feature. For more information, see Windows IAM Roles for Tasks.

networkMode

Supported: No

Additional notes: Docker for Windows uses different network modes than Docker for Linux. When you register a task definition with Windows containers, you must not specify a network mode. If you use the console to register a task definition with Windows containers, you must use the JSON input form and remove the network mode object; otherwise, the network mode is registered as bridge, which fails.

containerDefinitions

Supported: Yes

Additional notes: Not all container definition parameters are supported. Review the list below for individual parameter support.

name

Supported: Yes

image

Supported: Yes

memory

Supported: Unknown behavior on Windows side

Additional notes: The memory parameter is a required in Amazon ECS task definitions; however, there is no published documentation from Microsoft as to how this parameter behaves on the container instance. Amazon ECS treats this parameter in the same manner that it does for Linux container instances: if you provide 500 MiB to a container, that amount of memory is removed from the available resources on the container instance when the task is placed).

memoryReservation

Supported: No

portMappings

Supported: Limited

Additional notes: Port mappings on Windows use the NetNAT gateway address rather than localhost. There is no loopback for port mappings on Windows, so you cannot access a container's mapped port from the host itself.

cpu

Supported: Unknown behavior on Windows side

Additional notes: There is no published documentation from Microsoft as to how this parameter behaves on the container instance. Amazon ECS treats this parameter in the same manner that it does for Linux container instances: if you provide 500 CPU shares to a container, that number of CPU shares is removed from the available resources on the container instance when the task is placed.

essential

Supported: Yes

entryPoint

Supported: Yes

command

Supported: Yes

workingDirectory

Supported: Yes

environment

Supported: Yes

disableNetworking

Supported: No

links

Supported: No

hostname

Supported: Yes

dnsServers

Supported: No

dnsSearchDomains

Supported: No

extraHosts

Supported: No

readonlyRootFilesystem

Supported: No

mountPoints

Supported: Limited

Additional notes: Containers can mount whole directories on the same drive as $env:ProgramData. Containers cannot mount directories on a different drive, and mount point cannot be across drives.

volumesFrom

Supported: Yes

logConfiguration

Supported: Yes

Additional notes: The list of available log drivers for Docker can be found at Configure logging drivers in the Docker documentation. Amazon ECS currently supports a subset of the logging drivers available to the Docker daemon (shown in the valid values at logDriver); we have tested the awslogs and json-file log drivers with Windows containers on Amazon ECS. Additional log drivers may be available in future releases of the Amazon ECS container agent.

privileged

Supported: No

user

Supported: No

dockerLabels

Supported: Yes

volumes

Supported: Yes

name

Supported: Yes

host

Supported: Limited

Additional notes: Containers can mount whole directories on the same drive as $env:ProgramData. Containers cannot mount directories on a different drive, and mount point cannot be across drives. For example, you can mount C:\my\path:C:\my\path and D:\:D:\, but not D:\my\path:C:\my\path or D:\:C:\my\path.

Windows Sample Task Definitions

Below is a sample task definition that can help you get started with Windows containers on Amazon ECS.

Example Amazon ECS Console Sample Application for Windows

The following task definition is the Amazon ECS console sample application that is produced in the first-run wizard for Amazon ECS; it has been ported to use the microsoft/iis Windows container image.

Copy
{ "family": "windows-simple-iis", "containerDefinitions": [ { "name": "windows_sample_app", "image": "microsoft/iis", "cpu": 100, "entryPoint":["powershell", "-Command"], "command":["New-Item -Path C:\\inetpub\\wwwroot\\index.html -Type file -Value '<html> <head> <title>Amazon ECS Sample App</title> <style>body {margin-top: 40px; background-color: #333;} </style> </head><body> <div style=color:white;text-align:center> <h1>Amazon ECS Sample App</h1> <h2>Congratulations!</h2> <p>Your application is now running on a container in Amazon ECS.</p>'; C:\\ServiceMonitor.exe w3svc"], "portMappings": [ { "protocol": "tcp", "containerPort": 80, "hostPort": 80 } ], "memory": 500, "essential": true } ] }