Docker run throws error no space left error for /data/db
Getting Below error when run the docker
docker run -d -p 3000:27017 --name m1 --net mongo-net mongo mongod
2016-11-25T08:56:26.387+0000 I STORAGE [initandlisten] error creating journal dir /data/db/journal boost::filesystem::create_directory: No space left on device: "/data/db/journal" 2016-11-25T08:56:26.387+0000 I STORAGE [initandlisten] exception in initAndListen std::exception: boost::filesystem::create_directory: No space left on device: "/data/db/journal", terminating 2016-11-25T08:56:26.388+0000 I CONTROL [initandlisten] dbexit: rc: 100
I didn't face the issue when mount a volume to /data/db ocker run -d -p 3000:27017 -v /Users/user/work/m1:/data/db --name m1 --net mongo-net mongo mongod
Look like it has something to do with docker image
I would guess that you are on a Mac using "Docker for Mac". I think that the VM provisioned by docker does not have enough space and so mounting your host's directory gave it the space that it needed.
@yosifkit thats right. I could clean up some space by deleting unused docker instances and this error gone away
Also works if added: --smallfiles In compose you can use: command: mongod --smallfiles
What I've also seen on Docker for Mac is that the available disk space can be exhausted by too many local images. Removing unused images can help then.
docker volume prune is worked on this error message.
I faced the same issue and solved it on Mac, by going to the settings for Docker Desktop and increasing the allocated Resources.