Saturday, November 18, 2017

Get container logs on to the host machine using the VOLUMES

ecs register-task-definition --family xxxx-xxxx-xxxxapp --volumes "[{"name": "xxxxx-xxxx-appname","host": { "sourcePath": "/opt/logs/appname" } }]" --container-definitions "[{"name":"appname_container","image":"xxxxx.dkr.ecr.us-east-1.amazonaws.com/appname:${buildNumber}","cpu": 10,"memory":300,"workingDirectory": "/opt/appname","essential": true,"environment": [{"name": "NODE_ENV","value": "xxxx"}],"mountPoints": [ {"sourceVolume": "applicationname","containerPath": "/opt/applicationname/logs","readOnly": false} ],"portMappings": [ {"hostPort": 8080,"containerPort": 8080,"protocol": "tcp" } ],"command": ["node","bin/www"]}]" --network-mode "bridge".


VOLUME:

--volumes "[{"name": "xxxxx-xxxx-appname","host": { "sourcePath": "/opt/logs/appname" } }]"


Container path for logs (mounted to volume in the ecs-taskdefintion in the ECS)

"mountPoints": [ {"sourceVolume": "applicationname","containerPath": "/opt/applicationname/logs","readOnly": false} ]



No comments:

Post a Comment