我使用Vagrant创建了几个Docker容器。除了我无法控制容器的CPU和内存分配外,一切似乎都运行良好。下面你可以看到几次失败的尝试。
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.insert_key = false
config.vm.provider "docker" do |d|
d.build_dir = "."
d.force_host_vm = false
d.has_ssh = true
# d.cpus = "2" # works for vbox not docker
# d.memory = "4096" # same
d.create_args = [ "--privileged", "-v", "/sys/fs/cgroup:/sys/fs/cgroup:ro" ]
d.customize ["modifyvm", :id, "--cpus", "2"] # Also throws error
d.customize ["modifyvm", :id, "--memory", "4096"] # same
d.remains_running = true
end
config.vm.define :c7301 do |c7301|
c7301.vm.hostname = "c7301.ambari.apache.org"
c7301.vm.network :private_network, ip: "192.168.73.101"
c7301.vm.network "forwarded_port", guest:7180, host: 7180
end
有什么建议吗?