Last active
October 7, 2019 00:52
-
-
Save JasonSwindle/80d5c37a072bb6ddbd7e to your computer and use it in GitHub Desktop.
A task definition for ECS using MeltWater's Docker Container and Image clean-up containerized script. Please see https://github.com/meltwater/docker-cleanup for more details on correct usage.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"containerDefinitions": [ | |
{ | |
"volumesFrom": null, | |
"memory": 32, | |
"extraHosts": null, | |
"dnsServers": null, | |
"disableNetworking": true, | |
"dnsSearchDomains": null, | |
"portMappings": [], | |
"hostname": null, | |
"essential": true, | |
"entryPoint": null, | |
"mountPoints": [ | |
{ | |
"containerPath": "/var/run/docker.sock", | |
"sourceVolume": "docker_socket", | |
"readOnly": null | |
}, | |
{ | |
"containerPath": "/var/lib/docker", | |
"sourceVolume": "docker_data", | |
"readOnly": null | |
} | |
], | |
"name": "DockerCleanup-Container", | |
"ulimits": null, | |
"dockerSecurityOptions": null, | |
"environment": [ | |
{ | |
"name": "CLEAN_PERIOD", | |
"value": "**None**" | |
}, | |
{ | |
"name": "DELAY_TIME", | |
"value": "**None**" | |
}, | |
{ | |
"name": "KEEP_IMAGES", | |
"value": "**None**" | |
}, | |
{ | |
"name": "KEEP_CONTAINERS", | |
"value": "**None**" | |
}, | |
{ | |
"name": "KEEP_CONTAINERS_NAMED", | |
"value": "**None**" | |
}, | |
{ | |
"name": "LOOP", | |
"value": "true" | |
}, | |
{ | |
"name": "DEBUG", | |
"value": 0 | |
} | |
], | |
"links": null, | |
"workingDirectory": null, | |
"readonlyRootFilesystem": true, | |
"image": "meltwater/docker-cleanup:1.7.1", | |
"command": null, | |
"user": null, | |
"dockerLabels": null, | |
"logConfiguration": null, | |
"privileged": null | |
} | |
], | |
"volumes": [ | |
{ | |
"host": { | |
"sourcePath": "/var/run/docker.sock" | |
}, | |
"name": "docker_socket" | |
}, | |
{ | |
"host": { | |
"sourcePath": "/var/lib/docker" | |
}, | |
"name": "docker_data" | |
} | |
], | |
"family": "DockerCleanup-Task" | |
} |
@ernestm, a mild hack could be to expose a port that you're not using anywhere else. This would force all containers to be scheduled on distinct EC2 Instances.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Question - in a CloudFormation-created ECS stack, how do you get this to run one per instance? I've tried both running it in user-data and adding it in an upstart script dropped in via ::Init but neither one seems to interact right with when the ecs service is started.