在AWS-ECS Docker容器上扩展根分区

时间:2018-10-03 07:48:18

标签: amazon-web-services docker amazon-ecs

默认情况下,如何扩展某个任务定义的所有容器的根分区?如果它可以扩展实例或群集中的所有容器(包括ECS Agent),那仍然可以。

阅读https://docs.aws.amazon.com/AmazonECS/latest/developerguide/bootstrap_container_instance.html后,我尝试添加 #cloud-boothook cloud-init-per once docker_options echo 'OPTIONS="${OPTIONS} --storage-opt dm.basesize=25G"' >> /etc/sysconfig/docker进入自动缩放组的高级详细信息,但无济于事。

我还尝试了以下所有尝试(均未成功)(在同一位置):

sed -i '/^EXTRA_DOCKER_STORAGE_OPTIONS/s/"$/ --storage-opt dm.basesize=25G"/' /etc/sysconfig/docker-storage-setup

sed -i '/^DOCKER_STORAGE_OPTIONS/s/"$/ --storage-opt dm.basesize=25G"/' /etc/sysconfig/docker-storage

sed -i '/^OPTIONS/s/"$/ --storage-opt dm.basesize=25G"/' /etc/sysconfig/docker

他们都没有工作。

我尝试将ECS-Agent从1.18更新到1.23。 这些解决方案在两个版本上均失败。

docker info输出:

Containers: 2 Running: 2 Paused: 0 Stopped: 0 Images: 3 Server Version: 18.06.1-ce Storage Driver: devicemapper Pool Name: docker-docker--pool Pool Blocksize: 524.3kB Base Device Size: 10.74GB Backing Filesystem: ext4 Udev Sync Supported: true Data Space Used: 4.298GB Data Space Total: 106.1GB Data Space Available: 101.8GB Metadata Space Used: 708.6kB Metadata Space Total: 109.1MB Metadata Space Available: 108.3MB Thin Pool Minimum Free Space: 10.61GB Deferred Removal Enabled: true Deferred Deletion Enabled: true Deferred Deleted Device Count: 0 Library Version: 1.02.135-RHEL7 (2016-11-16) Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e runc version: 69663f0bd4b60df09991c08812a60108003fa340 init version: fec3683 Security Options: seccomp Profile: default Kernel Version: 4.14.67-66.56.amzn1.x86_64 Operating System: Amazon Linux AMI 2018.03 OSType: linux Architecture: x86_64 CPUs: 2 Total Memory: 7.503GiB Name: ip-172-30-1-205 ID: YY74:M3ZE:4J6G:W5TW:HI2U:GIWX:3ZJ7:LAM5:K5T3:MHVN:7T3Z:LGQP Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false

1 个答案:

答案 0 :(得分:0)

结果证明,我之前尝试过一些方法:

我犯了一个错误,就是没有将#cloud-boothook行添加到上方 #! /bin/bash

然后我刚刚在sed -i '/^OPTIONS/s/"$/ --storage-opt dm.basesize=25G"/' /etc/sysconfig/docker之后添加了cloud-init-per once docker_options

所以最终看起来像这样:

#cloud-boothook

#! /bin/bash

cloud-init-per once docker_options sed -i '/^OPTIONS/s/"$/ --storage-opt dm.basesize=25G"/' /etc/sysconfig/docker

那行得通。