LoginSignup
0
0

More than 5 years have passed since last update.

DockerのCPUsサイズを変更する

Posted at

想定環境

  • macOS High Sierra 10.13.5
  • Docker 18.03.1
  • Virtual Box 5.2.12

docker run の --cpus オプションは VM の CPU 以上は指定できない

Preferences > Advanced の設定では, CPUs: 4 になっていたとしても docker run --cpus 2 と指定して動かせるわけではない.

image.png

docker run すると docker: Error response from daemon: Range of CPUs is from 0.01 to 1.00, as there are only 1 CPUs available. というエラーが出る場合は,VM側で許可されている CPUs が 1 になっているため.

image.png

一度 docker container を停止し,Processors > CPUs 割り当てを増やす

image.png

docker container 作成時に指定するパターン

--virtualbox-cpu-count オプションで VM の CPUs 割り当てを指定.

docker-machine create -d virtualbox --virtualbox-cpu-count 2 dev
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0