Skip to content

Instantly share code, notes, and snippets.

@JasonSwindle
Created October 4, 2016 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JasonSwindle/9211a2f59f07fcae554a7fb7e44e5a7e to your computer and use it in GitHub Desktop.
Save JasonSwindle/9211a2f59f07fcae554a7fb7e44e5a7e to your computer and use it in GitHub Desktop.
[Unit]
Description=AWS ECS Agent
Documentation=https://docs.aws.amazon.com/AmazonECS/latest/developerguide/
Requires=docker.socket
After=docker.socket
[Service]
Environment=ECS_CLUSTER=ecstestcluster
Environment=ECS_LOGLEVEL=info
Environment=ECS_VERSION=latest
Environment=ECS_VERSION=latest
Environment=ECS_NETWORK=net
Restart=on-failure
RestartSec=30
RestartPreventExitStatus=5
SyslogIdentifier=ecs-agent
ExecStartPre=-/bin/mkdir -p /var/log/ecs /var/ecs-data /etc/ecs
ExecStartPre=-/usr/bin/touch /etc/ecs/ecs.config
ExecStartPre=-/usr/bin/docker kill ecs-agent
ExecStartPre=-/usr/bin/docker rm ecs-agent
ExecStartPre=/usr/bin/docker pull amazon/amazon-ecs-agent:${ECS_VERSION}
ExecStart=/usr/bin/docker run --name ecs-agent \
--env-file=/etc/ecs/ecs.config \
--volume=/var/run/docker.sock:/var/run/docker.sock \
--volume=/var/log/ecs:/log \
--volume=/var/ecs-data:/data \
--publish=127.0.0.1:51678:51678 \
--net=${ECS_NETWORK}
--env=ECS_ENABLE_TASK_IAM_ROLE=true \
--env=ECS_ENABLE_TASK_IAM_ROLE_NETWORK_HOST=true \
--env=ECS_LOGFILE=/log/ecs-agent.log \
--env=ECS_LOGLEVEL=${ECS_LOGLEVEL} \
--env=ECS_DATADIR=/data \
--env=ECS_CLUSTER=${ECS_CLUSTER} \
amazon/amazon-ecs-agent:${ECS_VERSION}
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment