问题原文
原帖链接 · Morpheu5 · CC BY-SA 3.0
I often have to re-build Docker images, and I do that inside the host I run my containers in. Occasionally I see that this puts considerable pressure on the CPU, so I thought I could run docker build under nice -n19, but this seems to make no difference in terms of how much docker yields when other processes need to run.
I'd rather not use Docker Hub repos, because this is private stuff and I'm trying to save every penny I can right now. I also know that I could set up another machine as a build/repo – I could use a machine at the office, for example – but I'm not sure how.
So, question: why does nice -n19 docker build ... seem to not be very helpful?
(bonus points for pointing me at docs on how to set up my own private build/repo machine)
已采纳解答
原帖链接 · Lie Ryan · CC BY-SA 3.0
why does nice -n19 docker build ... seem to not be very helpful?
The docker commands is a client of the docker daemon, which spawns the processes that runs in the containers. When you give a lower priority to the docker command, the priority of the docker daemon itself is unaffected, thus your build and exec runs at their default priority. It's like giving lower priority to your web browser does not mean that the web server is going to service your requests at lower priority.
how to set up my own private build/repo machine
For a basic separate build machine, you can just do docker export, scp, docker import. But for a more serious build system though, you may want to run a private docker registry. Some more useful documentations:
If you run your own private registry, you can do a build from your local workstation in office, then use docker push and docker pull to upload the docker image to your private registry and fetch it to wherever it needs to be.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
