简体   繁体   English

Docker 构建立即挂起(使用 minikube 和 ubuntu,目录中的文件不多)

[英]Docker build hangs immediatly (with minikube and ubuntu, with not many files in the directory)

Upon a fresh start of my ubuntu (on a virtualbox vm), I can build my images normally.在我的 ubuntu(在 virtualbox vm 上)重新启动后,我可以正常构建我的图像。 Then very inconstantly, it can be the next time I try to build, or the 10th time, it will hang forever after running the command docker build.然后非常不稳定,可能是我下一次尝试构建,或者第 10 次,运行命令docker build.

Dockerfiles are in directories with 5~10 other files (which eliminates the issue with massive file amount slowing down docker while trying to locate the Dockerfile, as seen on other posts) Dockerfiles 位于包含 5~10 个其他文件的目录中(这消除了在尝试定位 Dockerfile 时大量文件减慢 docker 的问题,如其他帖子所示)

If I try to build for a new, very simple, Dockerfile (to eliminate any syntax error), it will also hang whenever it hangs with my project's Dockerfiles.如果我尝试构建一个新的、非常简单的 Dockerfile(以消除任何语法错误),只要它与我的项目的 Dockerfile 一起挂起,它也会挂起。

Beside, I am running minikube --driver=none and my images are used for deployments in kubernetes.此外,我正在运行minikube --driver=none并且我的图像用于 kubernetes 中的部署。 (with none driver it's not required to run eval $(minikube docker-env) ) (没有驱动程序不需要运行eval $(minikube docker-env)

The only reliable fix is to stop the vm on which my ubuntu is running, start it again, and it will consistently allow me to build my images at least one time, then the issue comes back inconsistently.唯一可靠的解决方法是停止运行我的 ubuntu 的 vm,重新启动它,它将始终允许我至少构建一次映像,然后问题又不一致地出现。

This fix is quite inconvenient as I need to stop everything I am doing and it takes a bit of time.这个修复非常不方便,因为我需要停止我正在做的所有事情并且需要一些时间。

I have tried to run docker system prune and to delete all the images already built.我尝试运行docker system prune并删除所有已构建的图像。

What log could I check to find an issue going on when the build hangs?当构建挂起时,我可以检查哪些日志来查找正在发生的问题? Any idea of the origin of the issue?知道问题的根源吗?

Thanks a lot !非常感谢 !

Ok this bug was viscous.好的,这个虫子很粘。

Sometimes when I need to check how my nginx server behave in one of the containers, I open the VM's graphical interface and pop firefox to have a look.有时,当我需要检查我的 nginx 服务器在其中一个容器中的行为时,我打开 VM 的图形界面并弹出 firefox 进行查看。 I only figured today that firefox prompt a pop-up after a while, asking for the admin password in order to access the keychain.我今天才发现 firefox 会在一段时间后提示一个弹出窗口,要求输入管理员密码才能访问钥匙串。 And turns out docker do not build anything until this pop-up is open.事实证明 docker 在此弹出窗口打开之前不会构建任何东西。 Closing it or filling the password fixed my issue...关闭它或填写密码解决了我的问题......

On another terminal window, please check the Docker Daemon Log using sudo journalctl -fu docker.service at the time of build command hanging.在另一个终端 window 上,请在构建命令挂起时使用sudo journalctl -fu docker.service检查 Docker 守护程序日志。 Also, you can check the list of running processes during the build execution.此外,您可以在构建执行期间检查正在运行的进程列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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