简体   繁体   中英

MongoDB Docker container: ERROR: Cannot write pid file to /tmp/tmp.aLmNg7ilAm: No space left on device

I started a MongoDB container like so:

docker run -d -p 27017:27017 --net=cdt-net --name cdt-mongo mongo

I saw that my MongoDB container exited:

0e35cf68a29c        mongo               "docker-entrypoint.s…"   Less than a second ago   Exited (1) 3 seconds ago                       cdt-mongo

I checked my Docker logs, I see:

$ docker logs 0e35cf68a29c
about to fork child process, waiting until server is ready for connections.
forked process: 21
2018-01-12T23:42:03.413+0000 I CONTROL  [main] ***** SERVER RESTARTED *****
2018-01-12T23:42:03.417+0000 I CONTROL  [main] ERROR: Cannot write pid file to /tmp/tmp.aLmNg7ilAm: No space left on device
ERROR: child process failed, exited with error number 1

Does anyone know what this error is about? Not enough space in the container?

I had to delete old Docker images to free up space, here are the commands I used:

# remove all unused / orphaned images
echo -e  "Removing unused images..."
docker rmi -f $(docker images --no-trunc | grep "<none>" | awk "{print \$3}") 2>&1 | cat;
echo -e  "Done removing unused images"

# clean up stuff -> using these instructions https://lebkowski.name/docker-volumes/
echo -e  "Cleaning up old containers..."
docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v 2>&1 | cat;
echo -e  "Cleaning up old volumes..."
docker volume ls -qf dangling=true | xargs docker volume rm 2>&1 | cat;

We've experienced this problem recently while using docker-compose with mongo and a bunch of other services. There are two fixes which have worked for us.

  1. Clear down unused stuff
# close down all services
docker-compose down

# clear unused docker images
docker system prune

# press y
  1. Increase the image memory available to docker - this will depend on your installation of docker. On Mac, for example, it defaults to 64Gb and we doubled it to 128Gb via the UI.

We've had this problem in both Windows and Mac and the above fixed it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM