我像这样启动了一个MongoDB容器:

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

我看到我的MongoDB容器退出了:
0e35cf68a29c        mongo               "docker-entrypoint.s…"   Less than a second ago   Exited (1) 3 seconds ago                       cdt-mongo

我查看了Docker日志,看到了:
$ 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

有谁知道这个错误是关于什么的?容器中没有足够的空间?

最佳答案

我必须删除旧的Docker镜像以释放空间,这是我使用的命令:

# 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;

关于mongodb - MongoDB Docker容器: ERROR: Cannot write pid file to/tmp/tmp. aLmNg7ilAm:设备上没有剩余空间,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48235556/

10-16 23:18