Thinking Anew

Snap in Storage For Your Docker Playground

Floppy Disks

ICYMI (in case you missed it), a team from Oracle has been hard at work these few months churning out a bunch of Vagrant configuration files and scripts that help you provision some really cool virtual machines (VM), powered by Oracle Enterprise Linux. At the time of writing, here are some of the cool VMs you can build:

  • Vanilla Oracle Linux
  • Oracle Database
  • LAMP stack
  • Docker Container Registry
  • Docker Host
  • Kubernetes

Make sure you “star” or “watch” their repository for the latest updates.

I was recently tasked to develop a deployment guide using Docker for creating Oracle Application Express (APEX) on the Oracle Cloud Infrastructure. To setup my working environment, I decided to deploy an Oracle Database instance using the Docker images that Oracle has also open sourced previously. However, during that process, I encountered the dreaded: ERROR - There is not enough space available in the docker container. The container needs at least 15 GB, but only 4 GB are available.

My first thought was to set a larger container base size, but the VM was configured to use Btrfs as the storage driver, so that clearly wasn’t the issue. A quick check on the filesystem quickly revealed what the root problem was: free disk space!

$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 854M 0 854M 0% /dev
tmpfs 871M 0 871M 0% /dev/shm
tmpfs 871M 17M 855M 2% /run
tmpfs 871M 0 871M 0% /sys/fs/cgroup
/dev/mapper/vg_main-lv_root 32G 5.2G 27G 17% /
/dev/sda1 497M 99M 398M 20% /boot
vagrant 941G 172G 770G 19% /vagrant
vagrant_share 941G 172G 770G 19% /vagrant_share
/dev/sdb 16G 3.4G 11G 25% /var/lib/docker
tmpfs 175M 0 175M 0% /run/user/1000
s Storage Devices

The base OEL vagrant box downloaded came with two attached virtual disk. The second, was about 16 GB and was available to the system as /dev/sdb. This device is then used for the storage device for Docker containers.

See scripts/, line 21:

docker-storage-config -s btrfs -d /dev/sdb

To solve this issue, I needed to increase the amount of storage available to Docker. Fortunately for Btrfs, this is pretty easy to do.

  1. Shutdown the VM (using the Vagrant command to halt the system) so that I could add another 16 GB virtual disk.
Virtual disk OL7U5_x86_64-disk3.vmdk added
  1. Power on the VM.
  2. Check that the device can be “seen” by the operating system (OS):
$ lsblk
sda 8:0 0 36.5G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 36G 0 part
├─vg_main-lv_root 249:0 0 32G 0 lvm /
└─vg_main-lv_swap 249:1 0 4G 0 lvm [SWAP]
sdb 8:16 0 15.6G 0 disk /var/lib/docker
sdc 8:32 0 16G 0 disk
  1. Add the new device to the Btrfs volume:
$ sudo btrfs device add /dev/sdc /var/lib/docker
  1. Attempt to spread the data evenly (balance) across all devices:
$ sudo btrfs filesystem balance /var/lib/docker

Full balance without filters requested. This operation is very
intense and takes potentially very long. It is recommended to
use the balance filters to narrow down the balanced data.
Use 'btrfs balance start --full-balance' option to skip this
warning. The operation will start in 10 seconds.
Use Ctrl-C to stop it.
10 9 8 7 6 5 4 3 2 1
Starting balance without any filters.
Done, had to relocate 12 out of 12 chunks

Finally, check all went well and that we now have sufficient space to build our very own Oracle Database container.

$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 854M 0 854M 0% /dev
tmpfs 871M 0 871M 0% /dev/shm
tmpfs 871M 17M 855M 2% /run
tmpfs 871M 0 871M 0% /sys/fs/cgroup
/dev/mapper/vg_main-lv_root 32G 5.2G 27G 17% /
/dev/sdb 32G 3.4G 28G 11% /var/lib/docker
/dev/sda1 497M 99M 398M 20% /boot
vagrant 941G 175G 767G 19% /vagrant
vagrant_share 941G 175G 767G 19% /vagrant_share
tmpfs 175M 0 175M 0% /run/user/1000