docker mongodb and insufficient free space

If you’re running a mongodb instance inside a docker container you may end up after a while of starting and shutting down the containers with mongodb no longer starting and complaining with the error message

ERROR: Insufficient free space for journal files

Indeed if you run from within the failing container a df -h you may easily see that the space for the mongodb data is less than 3GB. In my case was /data/db inside the container itself as I don’t care to preserve the data.

Running a command like

docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v

clean-up all the cached docker filesystem which add up one on top of each other.

If you then run the docker container with the –rm flag it will automatically clean-up after exiting.

$ docker run -rm -it <image>




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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s