Docker and ECS Base Disk Size

Docker and ECS Base Disk Size

Recently, we came across an issue about docker container disk space. We temporally saved files in our docker container. The default size is 10G for all the containers. Our largest file is close to 7G, so the solution is to change the size to 20G.

Check the docker version
> docker --version
Docker version 1.12.6, build 7392c3b/1.12.6

Switch to root on these ec2 instances
> sudo -i

Modify the docker configuration to append the base size configuration to 20G
> vi /etc/sysconfig/docker

OPTIONS="--default-ulimit nofile=1024:4096 --storage-opt dm.basesize=20G"

Restart the Service
> sudo service docker restart

Start the ECS agent
> sudo start ecs

Check the docker status and info
> docker info
Containers: 36
Running: 8
Paused: 0
Stopped: 28
Images: 8
Server Version: 1.12.6
Storage Driver: devicemapper
Pool Name: docker-docker--pool
Pool Blocksize: 524.3 kB
Base Device Size: 21.47 GB
Backing Filesystem: ext4

We can see the Base Device Size is 21.47GB now, our changes work.

Get onto the Container
> docker exec -t -i c740f62443ff /bin/bash

Check the size
> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/docker-202:1-263177-1e8be92d66f9b4cbc33186a93859a385c6aba832a21c29ba49271364d632b988 9.8G 664M 8.6G 8% /
tmpfs 15G 0 15G 0% /dev
tmpfs 15G 0 15G 0% /sys/fs/cgroup
/dev/xvda1 40G 9.2G 31G 24% /etc/hosts
shm 64M 0 64M 0% /dev/shm

Upgrade the docker version on the build server
> sudo yum install docker

How to update the AWS cli tool
> pip install --upgrade --user awscli

Add this to the composer.phar install or update if we met some httpunit issue
> php composer.phar install --ignore-platform-reqs

Once thing we need to pay attention to is the build server. My understanding is this, if we only change the config on the docker running server, it does not work. We need to change the configuration on build server which we build our docker images.

Reference:
http://www.projectatomic.io/blog/2016/03/daemon_option_basedevicesize/
http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-install.html
https://github.com/aws/amazon-ecs-agent/issues/549
http://docs.aws.amazon.com/cli/latest/userguide/installing.html
https://hannesvdvreken.com/2015/01/18/composer-ignore-platform-reqs-flag/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值