Docker: Bus error/No space left on device

The Issue

When starting an application inside a (Linux) Docker container:

  1. the first execution results in a simple "Bus error" message to console (for free, no special logging to see this) and crashes
  2. the second, subsequent execution results in a "No space left on device" exception (not free, application does exception logging which made this visible)


Running a simple df -h from within the container shows us that all the available shared memory is used (the first execution mentioned above fills it up and fails with the bus error, the second then fails due to /dev/shm being out of space):

[root@080027368F54 /]# df -h
Filesystem Size Used Avail Use% Mounted on
overlay     39G  20G   20G 51%  /
tmpfs       64M    0   64M 0%   /dev
tmpfs      3.9G    0  3.9G 0%   /sys/fs/cgroup
shm         64M  64M     0 100% /dev/shm</strong>
tmpfs      3.9G    0  3.9G 0%   /proc/scsi
tmpfs      3.9G    0  3.9G 0%   /sys/firmware


Spin up the container with the --shm-size run option, e.g.:

docker run --rm -tid --network host --shm-size=1g <your_cool_name>


  • The specific application that resulted in the above is a C++ application running on CentOS


Bonus – docker run command to launch gdb

docker run --privileged --rm -it <your_cool_image> gdb -ex run /your/cool/app


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s