`
sillycat
  • 浏览: 2551364 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

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/
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics