のECS版です。
{ "family": "test-volumes-from", "volumes": [ { "name": "localtime", "host": { "sourcePath": "/etc/localtime" } } ], ... "containerDefinitions": [ { ... "mountPoints": [ { "sourceVolume": "localtime", "containerPath": "/etc/localtime", "readOnly": true } ], ...
Task Definitionのvolumes
でCluster Instance側のパスを指定し、containerDefinitions
内の各コンテナーの設定のmountPoints
でコンテナー側の/etc/localtime
に読み取り専用でマウントします。以上。
おまけ
素のAmazon LinuxをUTC+9にしてecs-agentを入れるUserData
#!/bin/bash unalias cp cp -f -p /usr/share/zoneinfo/Japan /etc/localtime cat << _EOT_ > /etc/sysconfig/clock ZONE="Asia/Tokyo" UTC=false _EOT_ yum install -y ecs-init echo ECS_CLUSTER=test >> /etc/ecs/ecs.config sudo service docker start sudo start ecs
base64 encoded
IyEvYmluL2Jhc2gKdW5hbGlhcyBjcApjcCAtZiAtcCAvdXNyL3NoYXJlL3pvbmVpbmZvL0phcGFuIC9ldGMvbG9jYWx0aW1lCmNhdCA8PCBfRU9UXyA+IC9ldGMvc3lzY29uZmlnL2Nsb2NrClpPTkU9IkFzaWEvVG9reW8iClVUQz1mYWxzZQpfRU9UXwp5dW0gaW5zdGFsbCAteSBlY3MtaW5pdAplY2hvIEVDU19DTFVTVEVSPWJhY2tsb2dfYWRtaW4gPj4gL2V0Yy9lY3MvZWNzLmNvbmZpZwpzdWRvIHNlcnZpY2UgZG9ja2VyIHN0YXJ0CnN1ZG8gc3RhcnQgZWNzCg==
参考
- Using Data Volumes in Tasks – Amazon EC2 Container Service
- Task Definition Parameters – Amazon EC2 Container Service