Skip to content

Instantly share code, notes, and snippets.

@sqs
Last active August 29, 2015 14:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sqs/8413803a15f8b6a9d3f3 to your computer and use it in GitHub Desktop.
Save sqs/8413803a15f8b6a9d3f3 to your computer and use it in GitHub Desktop.
Docker btrfs "no space left on device" when "processing triggers for libc-bin" in Ubuntu 14.04 host & container
# When running Docker (0.8-0.11.1) on an Ubuntu 14.04 or Amazon Linux host,
# using btrfs, the btrfs partition fills up when building a container with
# docker-in-docker.
#
# STEPS TO REPRODUCE:
# 1. Launch a new EC2 instance with Ubuntu 14.04, 64-bit, m3.large.
# 2. Log in with `ssh -i /path/to/key.pem ubuntu@ec2-hostname`.
# 3. Copy this script to the EC2 instance and run it.
# 4. Wait ~3 minutes, and you'll see the error at the bottom.
#
# This issue does not occur when using 'FROM ubuntu:12.04'.
#
# Last repro'd at Mon May 19 01:59:45 UTC 2014 by Quinn Slack
# <sqs@sourcegraph.com> on:
#
# $ uname -a # although the issue also occurred on 3.10.35-43.137.amzn1.x86_64
# Linux ip-10-100-171-20 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
#
# $ docker version # although the issue also occurred on 0.8 and 0.11.1
# Client version: 0.9.1
# Go version (client): go1.2.1
# Git commit (client): 3600720
# Server version: 0.9.1
# Git commit (server): 3600720
# Go version (server): go1.2.1
#
# To watch the btrfs partition fill up, open another ssh session and run:
#
# $ watch -n 1 'btrfs fi show; btrfs fi df /mnt; df /mnt'
sudo apt-get update
# clear out any existing docker containers (so you can rerun this script)
sudo docker ps -a -q --no-trunc | xargs sudo docker rm -f
sudo stop docker.io
# make btrfs
sudo apt-get install -qy btrfs-tools
sudo umount /dev/xvdb
sudo mkfs.btrfs -f -L docker-test /dev/xvdb
sudo mount -t btrfs -o rw,noatime,compress=lzo,space_cache,autodefrag /dev/xvdb /mnt
# install docker
sudo apt-get install -qy docker.io
sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker
# set up docker to use btrfs
sudo sed -i.bak 's/^#DOCKER_OPTS=.*$/DOCKER_OPTS="-s=btrfs -D -g=\/mnt"/' /etc/default/docker.io
sudo restart docker.io || sudo start docker.io
mkdir -p /tmp/mybuild
cd /tmp/mybuild
echo 'FROM ubuntu:14.04' > Dockerfile
echo 'RUN apt-get update -q' >> Dockerfile
echo 'RUN apt-get install -yq curl' >> Dockerfile
echo 'RUN curl -s https://get.docker.io/ubuntu/ | sh' >> Dockerfile
sudo docker build .
# This script will take ~3 min to run, and the last output will be:
#
# Setting up lxc-docker-0.11.1 (0.11.1) ...
# * Starting Docker: docker
# ...done.
# Processing triggers for ureadahead (0.100.0-16) ...
# Setting up lxc-docker (0.11.1) ...
# Processing triggers for libc-bin (2.19-0ubuntu6) ...
# 2014/05/19 01:59:47 write /mnt/btrfs/subvolumes/d294ed5ca61d325fef4d67c4c6d18ecad7f885f0ce51ffdd2ed3649fa7aa50ff/var/lib/docker/devicemapper/devicemapper/data: no space left on device
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment